compile and run a C program using a command-line ….

To compile and run a C program using a command-line C compiler, you have to go through the following steps:

(i) Write the C program (call it “myfile.c”) in a text editor or word processor (for example, the simple “Hello” program below),
(ii) Save it as a file on your computer’s hard disk,
(iii) “Compile it” to a computer-executable program by entering a compile command
at a command prompt, for example for the following C compiler programs:
gcc -Wall -o myfile myfile.c (using the GNU C compiler, UNIX or Microsoft Windows)
cl myfile.c (Microsoft Visual C++ command-line compiler)
bcc32 myfile.c (Borland C/C++ compiler, Microsoft Windows)
followed by the “Enter” key, and finally
(iv) Run the program by entering
myfile at a command prompt, again followed by “Enter”. If you want to save the output of “myfile” as a text file “myfile.txt”, enter instead myfile > myfile.txt

SHARE THE KNOWLEDGE


  

Advertisements

About Dinesh

I am engineering student........ I am selected in Microsoft Student Partner as MSP............

Posted on June 22, 2011, in C++, Knowledge. Bookmark the permalink. Leave a comment.

Leave a Reply

Please log in using one of these methods to post your comment:

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: