Jumat, 07 November 2008

Make Function Call with Project at DevC++

First open DevC++, Click File, New, Project. At Project1 left click and make new file. Write your body program and safe it with extention .c (eg.: myTest.c).

tes.h is the library that we made by ourself.
In this main function we can call the function that we made it into next section.
testprint (); and bintang (); are the function call, it is separate by new line (\n, escape sequence).


Next, left click on Project1 again make new file and add your function description in this section. Save it in the extention .c (eg.: tes.c). You can add more than one function description in this section and call in to main function in myTest.c.


In this section there are two function description it is void testprint() it will display "Hallo World" with two new line. The second function it is void bintang() it will display the riferse of triangle that has 4 rows and 4 columns. Don't forget to include the general library of C Language it is stdio.h the abbreviaton of standart input output and .h the extention of header file library. You can add more function in this section.


The last section is make the header file of this project. Left click on Project1 and make new file write the syntax of header file and save it into .h extention (eg.: tes.h). In this section there are containt the function prototype.

The syntax #ifndef _tes_h it is to check if the header file library name tes.h exist on the main program if yes we define it use #define _tes_h and this library function will be end with #endif. If there aren't exist it cannot use this function.
void testprint (); and void bintang (); are the function prototype of their function call and function description on the section above.

The result of this project is




I hope you understand and dont forget to try it.

For more informataion contact me at: 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: