How to Run a C Program in Terminal | C Tutorial - Awesome Aariz - Read Articles on Computer and Internet

Posts Ad

Tuesday, 8 November 2022

How to Run a C Program in Terminal | C Tutorial

In this post, I will be showing you guys how to compile and run/execute a C program in your terminal. But before I begin this tutorial, I expect that you would have already installed a Mingw C compiler on your PC otherwise this process will not work.

Steps to run a C program in terminal

  1. Open the location of your ".c" file.

  2. Press Shift + Right click which will open a dialog box. From here select "Open Command Window Here" or "Open Powershell Window Here". It will then open the terminal

  3. Type "gcc {name of file with extension}" and press enter. It will compile your code and create an executable file that you'll use to run your program

  4. Now type "a.exe" and it will run your program

That's it. You have successfully executed your C program in terminal. If you faced any issue, make sure you've followed all they steps correctly and ensure there's no error in your code. 

Please share this article with your friends. Thank you very much!

Post a Comment

Please do not spam!