How to Compile and Run a C Programs

How to Compile and Run a C Programs

To run C globally first you need to set the environment variable. To set the environment variable to follow the below steps:

Step 1) Right click on the Computer icon and click on the properties option.

Step 2) Now click on the Advanced System Settings

Step 3) Click on the environment variables option and make entry of C:\TC\BIN inside Path Variable and Click on OK.

How to Compile and Run a C Programs step3

Now open the command prompt by typing cmd inside “Run” Option and navigate to the Path Where you have saved your C Programs. See the below example.

D:\>cd C Programs and then D:\C Programs>

Suppose we have Saved hello.c program inside “C Programs” folder, then type this command to Compile hello.c

D:\C Programs>tcc hello.c

Also Read:
C Program: Find The Sum of Two Numbers
Prime Number Program in C Programming Language
Reverse Number Program in C

5) After typing “tcc command” we can compile C Program.

6) Now it’s time to run C Program after Successful Compilation.Just Type Program name and Hit Enter you will get output on the console

D:\C Programs>hello

Recommended Posts:


Prem Tiwari

An engineer by profession and a passionate blogger by heart. Founder of FreeWebMentor.com (A Programming blog for beginners), Tech Speaker at various forums. A part from this he is an open source enthusiast, WordPress Lover, Blogger, SEO, and Growth Strategic.

Article Tags: , , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Solved Programs