They're used-defined. You make up those functions.
Here's a short tutorial about them: http://www.cprogramming.com/tutorial/c/lesson4.html
Here's an example of a function . . . .
Code:
#include <stdio.h>
/* this is the prototype of a function */
int square(int x);
int main() {
int r = square(3);
printf("3 squared is %i\n", r);
return 0;
}
int square(int x) {
int s = x * x;
return s;
}
Basically, a function has several parts.
Code:
<return-type> <function-name>(<parameters>) {
<code>
<return-statement>
}
The return type is what the caller of the function will receive. For example, if this was int, the caller could go
Code:
int x = function();
The value returned from a function is specified by a return statement, like so:
Code:
int function(void) {
return 3;
}
If the return type is "void", the function doesn't return anything and you use use
or leave out the return statement entirely.
The parameters are a comma-separated list of variables that are passed into the function -- data from the original caller function. For example:
Code:
#include <stdio.h>
void add(int x, int y);
int main() {
add(3, 4);
return 0;
}
void add(int x, int y) {
printf("%i\n", x + y);
}
If a function doesn't pass any parameters, you can use "void" for the parameter list.
Anyway -- for a much clearer explanation, check out the nearest C book . . . .