GeekInterview.com
  I am new, Sign me up!
 
Home C
 

How to develop compile and run a C program

 
Category: C
Comments (4)


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 like GNU C compiler called as gcc, Sun compiler, Borland compiler which is popular with PC system and so on. Lots of options are available 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 programmer must note 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


4. After compilation 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.



Read Next: What are the Format Specifiers used with printf?



 
Related Topics


 

Comments


milind_29 said:

  hi i am learning c programing by my own,i need a help ,i had created a sample c program in notepad, i had saved the file with .c extension. now i don't know how to compile it .i am using windows xp. which compiler i have to use and where can i get it.
pls reply
February 18, 2008, 9:09 am

sushilV said:

  you can use quincy C/C++ compiler from doctor dobbs portal.
July 30, 2008, 2:15 am

sumayya_sameena said:

  i want to learn vc++ and Xml.
i also want a breif about various data stuctures
please give me a website address
December 15, 2008, 12:13 am

navybala said:

  i want a program to accept 3 numbers and print all the possible combinations of the three numbers
November 9, 2009, 9:12 am

Post Your Comment:

Members Please Login
Your Name:*
e-mail ID:(required for notification)*
Image Verification: 
 
 Subscribe    

Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact  

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape