Vote Up 0 Vote Down

run c program in ubuntu

How to run c program using terminal ???


Vote Up 0 Vote Down
Lets say your program is test.c then for

 gcc -o test.out test.c

To Run:

flag | link |
Vote Up 0 Vote Down
1)First compile it using

gcc : gcc file_name.c



(for runing the prgm.)
flag | link |
Vote Up 0 Vote Down
To run c program first of all you have to compile with gcc compiler
./a.out it is to run the program

 gcc demo.c

or another method

 gcc demo.c -o ss

here ss can be replaced by any name. ss is a binary file that is created when we compile the file with gcc
another example--

 gcc demo.c -o demo
flag | link |
Vote Up 0 Vote Down
First you need to make sure it has execution rights. Then just type in terminal: ./programname

To make a file executable and runnable by any user:

chmod a+x myfile
flag | link |

Your Answer

Login before answering

Login with facebook