How to run / execute a c file / program through command prompt / terminal in linux / windows / ubuntu

Step 1 : Open Terminal

Step 2 : Go to the directory where your .c file is located.

Eg: cd /home/test/test.c (for ubuntu)

or

Eg: cd D:\Test\test.c (for windows)


/******************** test.c ********************/

#include <stdio.h>
 void main()
 {
 printf("Hello, World! \n");
 }

/******************** test.c ********************/

Step 3 : Execute the following command

 gcc test.c -o test

Step 4 : The following command will create a test.exe file

Step 5 : Once test.exe is created your c file has been compiled successfully.
Now execute the following command
./test

Step 6 : You can see the o/p of test.c

Advertisements

Tags:

About krishjlk

http://www.facebook.com/krishna.kanth.121

One response to “How to run / execute a c file / program through command prompt / terminal in linux / windows / ubuntu”

  1. he capital to accomplish all of his shoes corrective a altered blush at the actu says :

    I discovered your blog site on google and test a couple of of your early posts. Proceed to maintain up the very good operate. I just extra up your RSS feed to my MSN Information Reader. In search of forward to reading more from you later on!…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: