Sorry but no, we don't directly do homework on this forum. Anyway I was just guessing based on the problem type, you weren't actually clear enough in the original post to figure out which interpretation is required by the assignment.
Here are some thoughts. A function is a separate piece of code that you can run/invoke/call by its name. For this to work, you need a function prototype (name of function with arguments and a semicolon), which declares the function and lets you call it after that point. You need an actual function definition, which has the code within the function that will run when you call it. And then you need the function call itself, which is the point (e.g. in main) that you want to jump to the function's code and run. When the function is done, it will return to the original calling location. Example:
Code:
void two(void);
int main() {
printf("1\n");
two();
printf("3\n");
return 0;
}
void two(void) {
printf("2\n");
}
That prints 1, 2, 3. There are two other major things you can do with functions. The first is that you can pass in arguments,
Code:
void print(int x);
int main() {
printf("1\n");
print(2);
printf("3\n");
return 0;
}
void print(int x) {
printf("%d\n", x);
}
and the second is that you can return values.
Code:
int important(void);
int main() {
int i = important();
printf("the function thinks this is important: %d\n", i);
return 0;
}
int important(void) {
return 42;
}
Of course, the two can be combined together for something like
Code:
long factorial(int n);