unistd.h provides declarations of those two functions as well as other things, see 'man unistd.h' for more details.
A practical example:
Code:
#include <stdio.h>
int main() {
printf("%4.2lf\n", multiply(2.4, 3.5));
return 0;
}
double multiply(double x, double y) {
return x * y;
}
The multiply function comes after main, so when used in main it is declared implicitly.
The compiler accepts my usage, and expect the function to return int. When run, the program prints 0.00.
Note that this example doesn't compile in gcc 3.4 and 4.0, but it does in 3.2 and possibly 3.3, and in icc.
Then, we try this:
Code:
#include <stdio.h>
double multiply(double x, double y);
int main() {
printf("%4.2lf\n", multiply(2.4, 3.5));
return 0;
}
double multiply(double x, double y) {
return x * y;
}
The only difference is that I've provided a declaration of the multiply function. Now the program prints 8.40.