What does function mean?


#1

I’m having some difficulty to identify a function in a project.

#include <stdio.h>
#include <unistd.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);
sleep(2);
congratulateStudent(“Bo”, “Objective-C”, 2);
sleep(2);
congratulateStudent(“Mike”, “Python”, 5);
sleep(2);
congratulateStudent(“Ted”, “iOS”, 5);

return 0;

}

In the example above, “printf()” and “sleep()” are functions, right? “Mark”, “Cocoa” and “5” are arguments that are linked to “student”, “course” and “numDays” which are parameters . So, what is congratulateStudent? A function too? Or the function name?


#2

You are calling the function printf(). You are implementing the function main().

You are both implementing and calling the function congratulateStudent().

And “Mark”, “Cocoa”, and 5 are arguments that are being passed to the function.