1.6 – How to execute a C program in command prompt using Turbo C compiler

by subbu on July 26, 2013

Executing a C program in command prompt using Turbo C compiler:

In the previous session we have learned how to install Turbo C++ 3.0 and execute a C program using IDE. Now we will see how we can configure Turbo C++ 3.0 for command line execution.

The Turbo C compiler TCC is existed with in the bin directory of Turbo C default folder TC  (c:\tc\bin). It can be accesses only within the bin directory so that, C programs in other locations can’t be compiled. To access The Turbo C compiler TCC from any where, we set the path to its parent folder c:\tc\bin.

By setting path we inform the operating system to show files of a particular folder to any where.

TCC location

Setting path to the parent folder of TCC (c:\tc\bin)

Step1: Right click on “My computer” – select “properties”

setting path

Step2: select “advanced” tab – select “Environment Variables”

setting path

Step3: Select “path” variable – select edit

setting path

Step4: Add c:\tc\bin;.; to the path value. Make sure that the existed path must not be erased, which  result some of the applications may malfunction.

setting path

Executing the C program:

Step1: Go to the command prompt by selecting start – run – type cmd – select open
Step2: create your personal folder (demo) and change to it.
Step3: open the text editor with the program name (first.c)

d:\>md demo
d:\>cd demo
d:\demo>edit first.c

opening the text editor

Step4: Type the program

int main()
printf("Hello World");
return 0;

a simple C program

Step5: Save and exit from the text editor by selecting file – exit
Step6: compile the program (first.c) using the turbo C compiler TCC, It produces the executable file with the program name (first.exe)
Step7: execute the executable file with the file name.

d:\demo>tcc first.c

executing a C program

Previous post:

Next post: