Functions are very useful in programming. I've already used programmer-defined functions in lab 3 and I'm pretty sure I'll have to use them in the next labs that come.
The Function Declaration:
ex:
int result (int x, int y);
//Adds x and y and outputs the result.
The Function Call:
ex:
sum = result ( x , y );
The Function Definition:
ex:
int result (int x, int y)
{
int sum;
sum = x + y;
return (sum);
}
No comments:
Post a Comment