Monday, July 27, 2009

How to run C programs in Unix/Linux environment?

1. name your source code with .c extension.


2. type gcc %26lt;sourcefilename.c%26gt; or cc %26lt;sourcefilename.c%26gt;


3. your source code will be compiled and the output file is named as a.out.


4. type a.out at the prompt to execute your program.





By default all compiled files will be compiled to a.out output file as a executable.


you can change this with optional parameter


-o%26lt;newoutputfilename%26gt;

How to run C programs in Unix/Linux environment?
you can compile it using gcc hello.c


by default it will create a file called a.out , to run the program





./a.out
Reply:Write the program code.


Compile the written code.


Link the object file.


Run the executable file.


No comments:

Post a Comment