Tuesday, 27 October 2015

How to Run and Compile C program in command prompt[cmd] using gcc[turbo c] in windows/7/8

While running the C Programs on any platform one should need to store all the programming files to the Turbo C default director like C:\TC\Bin.. Then only you can run it. If you want to execute your programs from any storage location of your computer that is, what I mean is from any directory of  your computer, then you can compile it using gcc in the command prompt.

What is GCC (GNU Compiler Collection)?

                 The GNU Compiler Collection includes front ends for C, C++, Objective-C, Fortran, Java, Ada, and Go, as well as libraries for these languages (libstdc++, libgcj,...). GCC was originally written as the compiler for the GNU operating system. The GNU system was developed to be 100% free software, free in the sense that it respects the user's freedom. You check more information about it here and download one of of them here.

 The following are the steps need to follow for run c programming Command Prompt using windows. 

1. First You need to set the path variable for Turbo Compiler as


By right clicking on the my computer--choose advance---environment variables---in that search for path--copy the TC path.

2. Now go to command prompt and change your directory where your program are saved and check TC is sett or not. If your program name is sum.c check like this 

       tcc sum.c

It will return a message like this 

When your typing above command and if there are no error in your program, two files are created by Turbo Compiler namely the .exe file and The .obj file like

It your program does not want any input from the keyboard them to get output compile the program just by giving it's name at command prompt.

If your program wants input from the keyboard, open the exe file created in step-2 and it will ask the input give the input and press enter to get out put.

That's it you have done. Happy programming. If you like out post please share with your friends.


Post a Comment

Note: only a member of this blog may post a comment.

Find Us On Facebook

python tutorial


C Programming


Java Tutorial


Data Structures


MS Office


Database Management