2 questions. No semi-colon and what's with the stars?


#1
#include <stdio.h>

void congratulateStudent(char *student, char *course, int numDays)
{
    printf("%s has done as much %s Programming as I could fit into %d days.\n", student, course, numDays);
}


int main(int argc, const char * argv[])
{

    congratulateStudent("Mark", "Cocoa", 5);
    congratulateStudent("Bo", "Objective -c", 2);
    congratulateStudent("Mike", "Python", 5);
    congratulateStudent("Ted", "iOS", 5);
    
    return 0;
}

This works for me and I get the principles I think.
Can anyone help me with a couple of Q’s.
I’d have expected to put a semi-colon at the end of:

void congratulateStudent(char *student, char *course, int numDays)

Why does it work without it?

and

Why do we need an asterisk before the parameters ‘student’ and ‘course’ (I’m guessing it’s something to do with them being ‘char’ variable types but in the section where they are described in Chpt 3 this doesn’t come up?)


#2

While you’ll sometimes hear “Put a semicolon at the end of every line in C,” that isn’t really true.

For example when you are defining a function: The function contains a bunch of steps that you want executed. You must put a semicolon after each of those steps (AKA statements). But, you don’t need semicolons anywhere else. In particular, you don’t need a semicolon after the declaration of the function (the line where you give it a name, a return time, and a set of arguments)


#3

Thanks and I’ve only just spotted the semi-colon is also absent from the main declaration.
And yet if I declare something else like a variable:

eg. float weight;

I do place the semi-colon.

I’m guessing I’m missing something deeper about what the semi-colon really tells the compiler and it will just fall into place.
In my head I’m saying to myself ‘the curly bracket is the beginning of a set of steps and so the compiler isn’t done with this yet’.