Kamis, 06 November 2008

Function

Function adalah pecahan program yang lebih kecil.

Menggunakan function:
1. Understanable and manageable parts
2. Reused the codes (block code)
3. Standard function -> printf(); scanf(); getch();

Three main part function:
1. Prototype function
2. Function call
3. Function Definition

Prototype Function
Prototype function is the declaration of a function. It is declare into global declaration. There are two type of declaration its global declaration and local declarataion. The global declaration it is where the function declare, not only function variable or struct or objeck can be declare in this area. The area of global declaration it is on the main function of c language program and under the include of header file of this language.
The local declaration it is in the body or block of main function. We can declare variable and others in this area.

#include of the header file
//# said prototype declaration, the beginning of writting the c language program

Global Declaration;

int main () //main function
{
Local Declaration;

return 0;
}


Function Call
Function call is the calling of the function that call the proses of this function into main function or it can call from others function.

int main ()
{
...

function call;

...
return 0;
}


Function Definition
Function definition is the definition or description of the function body. It usualy after main function or before main function. If the function definition before main function it not be necessary to use prototype function.

int adding(int a, int b)
{
c = a+b;

return (c);
}


I hope you enjoy with this learning. Don't be borring and always try to write the program. Enjoy your life with programming. Programming Make Life Easy.

For more information contact me into chrifto@yahoo.co.id or chrifto@gmail.com

Practice Make Perfect ^_^

by : Chrifto M Sepang
Fear the Lord is the Beginning of Knowledge.

Tidak ada komentar: