How To Run C in Visual Studio Code on Windows 10

Running a c program varies between different operating systems. However running it in visual studio code is pretty simple and does not requires any rocket science, just follow the steps mentioned in this article and you’ll be good to go. So in this article let’s find out how you can run c in visual studio code.


Video Tutorial: How to Run C in Visual Studio Code

If you’re finding it hard running C Programs in Visual Studio Code on your Windows 10 machine then you can refer to the below video for a complete guide.



Step 1: Downloading the C Compiler for Windows 10


1) firstly we will download the C compiler for our windows machine and for that we’re going to download the “MinGW” compiler. Follow the download link provided below you’ll be redirected official site of MinGW.


Download MinGW Compiler Here:


2) We will download the self extractable archive for MinGW to make our installation process easy and simple. So simply click on the “MinGW-17.1-without-git.exe” and your download will start.



3) Once your download gets finished open it from the folder where it has been downloaded and double click on it to start the installation process.



4)Now you’ll be asked to choose the extraction location of the compiler, in the text field type “C:\” and click on the extract button. Extraction of this archive will take some time so keep patience.



5) Next, we will set up the environment variables for accessing GCC in vs code, and to do so, first copy the location of the bin folder from the newly extracted MinGW directory. In our case, it looks like this: “C:\MinGw\bin“.



6) Now, open up the properties of your windows machine and click on the advanced settings button.




7) Click on the environment variable button, select the path option and click on the edit button.



8) Now click on the “New” button and paste the location we’ve copied from step 1.5 in this blank field and click ok.




Step 2: Verify gcc Version

1) Open Up the command prompt, type “gcc –version” and press enter.



If you’re able to get similar output to the above image then congrats you’ve successfully installed MinGW Compiler in your windows 10.


Step 3: Installing C Extension in Visual Studio Code


1) Open vs code, click on the extension button and in the search bar type “C/C++“, select the first option from Microsoft and click on the small blue install button.



2) Now again, search for “code runner”, select the first option from Jun Han and install it as well.



with this extension, you can run the code by pressing Ctrl+Alt+N and stop the same by pressing Ctrl+Alt+M


Step 4: Run C Program in Visual Studio Code


1) Create a New File in Vs Code, save it as “Subscribe.c” and paste the below code snippet.



Code Snippet

#include <stdio.h>

 int main(){

 printf("Subscribe Now");

 return 0;




Make sure to add extension “.c” at the end of the name as without it vs code won’t be able to detect the program as a c program.


2) Click on the small play button and Voila your program is successfully executed.




Now start your journey of c programming ✌️✌️

Also Read: How To Run C in Visual Studio Code on Windows 10


I'm a coding geek interested in cyberspace who loves to write and read

2 thoughts on “How To Run C in Visual Studio Code on Windows 10

  • August 16, 2022 at 5:45 PM

    Thankyou for your answer..

  • August 16, 2022 at 5:47 PM

    Thank you for your complete explaination…


Leave a Reply

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