C program in ubuntu

Asked by aneesh

Please give me the steps to create, compile, and run a C program in ubunutu ?

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu gcc-defaults Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
theneoindian (theneoindian) said :
#1

Okey here it goes :

1. open up an editor of your choice - gedit for me
2. type in the program
3. save the program with any filename for eg test.c
4. open up the terminal
5. cd in to the directory where u saved the file
6. type "gcc filename" , here it 'll be "gcc test.c"
7. gcc 'll display errors , if ur pgm has any error .. Go and correct it and go back to step 6 till you get no errors . Warnings may be ignored ;)
8. after successfull compilation , a file called "a.out" 'll be made by gcc in the same directory . it is the executable object file .
9. to run it type in "./a.out"
10. Look at the output 4 a few seconds and say "Voila , I did my first C program " -> not an essential step ;)

Revision history for this message
arochester (arochester) said :
#2

Full Circle, a FREE, downloadable magazine, ran a series on programing with C a couple of years ago. Look here: http://fullcirclemagazine.org/2008/09/

Can you help with this problem?

Provide an answer of your own, or ask aneesh for more information if necessary.

To post a message you must log in.