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

If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.

Recommended Posts:

Article Tags: , , , ,