Minggu, 30 Oktober 2011
Function in C
After studying input-output in C, selection, and repetition, the more there are functions in C
Function: Part of the program aimed to perform a specific job and the location is separated from the programs that use it. The program of the set of C language functions ofgroups, ranging from the main function, pustka functions, or functions made by theprogrammer.
Benefit functions:
- Features a program that C has a clear structure. By separating the detailed steps to one or more functions, the main function (main ()) will be shorter, clearer and easier to understand.
- The functions can be dijinkan to avoid writing the same repetitive. The measures of the same program and are often used repeatedly can be written once separately in the form ofthe functions, the program requires further steps are enough to call these functions.
The final value of a function is the value returned by the function of the input parameters are entered.
Examples of functions:
int score (int x, int y, int z)
{
return (x + y + z) / 3;
}
Known function of the term in the Formal Parameters and Actual Parameters:
a. Formal parameter is a parameter which is in defining a function.
b. Actual parameter is a parameter which is at the time of the calling function.
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar