Friday, May 18, 2007

C PROGRAMMING IN LINUX

If you are new to Linux, you will be in dilemma about how to code in C. Remember that Linux is fully coded in C !!!!!. and C is developed in an intention to develop UNIX !!!!. So coding in C is not a myriad task at all. The following steps will help you to achieve it.


1) Create a new file with extension .c in your folder.

2) Open the file and write the program. Finish it by saving (for eg; file1.c here).

3) Right click on the desktop and open terminal

4) In the terminal, change into your folder by using cd command.

5) Type gcc file1.c and press enter. If there are errors, they will be listed here.

6) Successful compilation would lead to the creation of an executable file a.out . Run that by using the command ./a.out . The result will be displayed in the terminal.


NOTE:- In Linux, header files like CONIO.H are not present. Including it in your program would cause compilation errors. Also main should return a value to the O.S.

No comments: