How to develop, compile and run a C program

The steps involved in building a C program are:


1. First program is created by using any text editor and the file is stored with extension as .c


2. Next the program is compiled. There are many compilers available say GNU C compiler called as gcc, Sun compiler, Borland compiler popular with PC system and so on. There are lots of options for compiling. Generally the compilation is done as below



cc name of the file.c



At this stage errors like typing mistake, mistake in key words, syntax usage errors will be detected and will displayed which the programmer can correct. But a note must be made that compiler cannot detect logical errors.


3. After this process the compiled or executable code by default gets stored in a.out. If one wants to store the executable code in a filename instead of in a.out this can be done by using the -o option along with cc as follows:



cc -o sample sample.c



The above will store the executable code in file sample.


4. After this the program is executed by using the executable file name. At this stage runtime errors or incorrect output due to logical or functional errors may be seen in output which is corrected further and the process is repeated until the correct result is displayed.

Questions by GeekAdmin   answers by GeekAdmin

Showing Answers 1 - 3 of 3 Answers

Usually it is very easy to develop a C program.Actually, There are many IDE's are available for C Programs.Just you take the ANSI IDE it is the standard compiler for C programs.Here I explained about ANSI IDE.In that Just Type a c program. and then save that file with the extension of '.c' thengo to the menu RUN and click COMPILE. While compiling it will show the errors in your program.And then Just Click Build or RUN on RUN Menu. THe n your output will be shown in a black and white window.To see the output Just Press "Alt + F5'.I am in need of your reply,from ashokraja_cm@yahoo.co.in

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions