Im on windows.. Here i have for my setup I download C compiler from winlibs website, VSCode and then simply use make to compile and run my code.. As simple as that Answer from nmsobri on reddit.com
🌐
Visual Studio Code
code.visualstudio.com › docs › languages › cpp
C/C++ for Visual Studio Code
November 3, 2021 - C/C++ support for Visual Studio Code is provided by a Microsoft C/C++ extension to enable cross-platform C and C++ development on Windows, Linux, and macOS. When you create a *.cpp file, the extension adds features such as syntax highlighting ...
🌐
Visual Studio Marketplace
marketplace.visualstudio.com › items
C/C++ - Visual Studio Marketplace
April 29, 2026 - Extension for Visual Studio Code - C/C++ IntelliSense, debugging, and code browsing.
🌐
PW Skills
pwskills.com › blog › cpp › c-programming-in-vs-code
Can I Use C Programming in VS Code? Explained in Detail!
October 30, 2025 - After building, you can use the debugger (if configured) or run the compiled executable manually. Also read: 75 Basic Programming Problems and Tutorials for Practice · The short answer is yes, you can use C programming in VS Code.
🌐
Medium
medium.com › @ochwada › c-programing-setup-in-visual-studio-code-bd4cb60e58ff
C Programming — Setup in Visual Studio Code | by Ochwada | Medium
November 16, 2024 - HEADER_H is a macro that is defined when the header is included for the first time, so if the file is included again, the content between #ifndef and #endif is ignored. ... This defines a macro PI with the value 3.14159, representing the mathematical constant π. This value can be used throughout the program wherever PI is referenced.
🌐
Visual Studio Code
code.visualstudio.com › docs › cpp › config-mingw
Using GCC with MinGW
November 3, 2021 - Remember, the C++ extension uses the C++ compiler you have installed on your machine to build your program. Make sure you have completed the "Installing the MinGW-w64 toolchain" step before attempting to run and debug helloworld.cpp in VS Code.
Top answer
1 of 1
1

To run a C program in Visual Studio Code, follow these steps:

  1. Install the C/C++ Extension: Ensure you have the C/C++ extension installed in Visual Studio Code. You mentioned you have this set up, which is great.
  2. Set Up a Workspace: Create a new folder for your C projects. Open Visual Studio Code and select File > Open Folder... to open your newly created folder.
  3. Create a C File: Inside your workspace folder, create a new file with a .c extension (e.g., hello.c). You can do this by right-clicking in the Explorer pane and selecting New File.
  4. Write Your Code: Write your C code in the newly created file. For example:
       #include 
       
       int main() {
           printf("Hello, World!\n");
           return 0;
       }
    
  5. Configure Build Tasks: You need to set up a build task to compile your C code. Press Ctrl + Shift + B to open the build tasks menu. If prompted, select Create tasks.json file from template and choose Others. Modify the generated tasks.json file to include the following:
       {
           "version": "2.0.0",
           "tasks": [
               {
                   "label": "build",
                   "type": "shell",
                   "command": "gcc",
                   "args": [
                       "-g",
                       "${file}",
                       "-o",
                       "${fileDirname}/${fileBasenameNoExtension}"
                   ],
                   "group": {
                       "kind": "build",
                       "isDefault": true
                   },
                   "problemMatcher": [
                       "$gcc"
                   ],
                   "detail": "Generated task by gcc"
               }
           ]
       }
    
  6. Build Your Program: Press Ctrl + Shift + B again to build your program. This will compile your C code and create an executable in the same directory.
  7. Run Your Program: Open the terminal in Visual Studio Code (View > Terminal or `Ctrl + ``) and run your program by typing:
       ./hello
    
    (Replace hello with the name of your executable if different.)
  8. Debugging: To debug your program, you will need to set up a launch configuration. Go to the Run view (left sidebar) and click on create a launch.json file. Choose C/C++: g++ build and debug active file. This will create a launch.json file where you can configure debugging settings.
  9. Start Debugging: Set breakpoints in your code by clicking in the gutter next to the line numbers. Then, press F5 to start debugging your program.

By following these steps, you should be able to set up Visual Studio Code for C programming and run your code successfully.


References:

  • Walkthrough: Compile a C program on the command line
Find elsewhere
🌐
freeCodeCamp
freecodecamp.org › news › how-to-write-and-run-c-cpp-code-on-visual-studio-code
How to Write And Run C and C++ Code in Visual Studio Code
January 20, 2023 - After writing your code, you can run the code directly using the play button you'll find in the upper right corner. This is how you can run any C/C++ program from VS Code/Insiders
🌐
Reddit
reddit.com › r/c_programming › c in visual studio code
r/C_Programming on Reddit: C in Visual Studio Code
April 26, 2024 -

I want to practice C in Visual Studio Code (mac). I was already prompted to download a bunch of add ons for C and other languages such as CSS and HTML.

I wrote my code and tried to run the executable in the terminal but apparently I need to download the "command line developer tools" package. I had to stop myself because it requires a whopping 15.6 GB of disk space while the program itself is only 580 mb. How can this be if there are sandbox programs which you can code in on your browser? As far as I understood people have been coding in c since a hard drive of 512 mb was considered big...

🌐
DEV Community
dev.to › haythammostafa › run-c-code-in-visual-studio-code-2j86
Run C Code in Visual Studio Code - DEV Community
July 3, 2023 - C++, built on C, is faster because of its object-oriented nature and is the most used language in competitive programming. C is very close to hardware and can directly interact with it(managing memory). The C code you write is converted into assembly language by the compiler and then run as instructions on the hardware.
🌐
YouTube
youtube.com › watch
How to Setup C/C++ in VS Code [Updated 2025] Complete Installation with example | Amit Thinks - YouTube
Learn how to setup and run C/C++ on VS Code. We will also run an example C file after the setup.C Tutorial (English): https://youtu.be/CobHIiQXMtQC Tutorial ...
Published   January 15, 2025
Top answer
1 of 2
3

The guide for using C++ with Visual Studio Code is located here:

  • C/C++ for Visual Studio Code

If you are using the windows operating system, you can install the Microsoft Visual C++ (MSVC) compiler toolset as described here:

  • Configure VS Code for Microsoft C++

Otherwise you should read the tutorials for the compiler you want to use:

  • Tutorials for other compilers

The reason I refer to links, instead of explaining the details here, is because the answer might become outdated/obsolete. Sometimes links are better than explanations.

2 of 2
2

Step 1. Download the MinGW - Minimalist GNU for Windows at SourceForge, link here.

When you download Minimalist GNU for Windows (MinGW), you can choose which packages to install. You should select the following packages:

  • mingw-developer-toolkit
  • mingw32-base
  • mingw32-gcc-g++
  • msys-base

Then click on the Installation tab on the top left and click on Apply Changes.

After installation, go to your C Drive where the MinGW is installed, and enter the folders MinGW > bin. Copy the path C:\MinGW\bin

Now search for environment, and enter edit environment variables for your account. screenshot

Next, double-click on Path, click on New, paste the path C:\MinGW\bin, press enter, and click OK.

Verify that it has been installed correctly by opening up Command Prompt and typing in gcc --version. It should give you the current version number.

Step 2. In Visual Studio Code, click on the Extensions tab, search and install Code Runner by Jun Han

Step 3. In the C/C++ Configurations. Make sure the Compiler Path has c:/MinGW/bin/gcc.exe selected. screenshot 2

You can get to it by opening Command Pallet (ctrl+shift+p) typing in C/++: Select a Configuration.. then select Edit Configurations (UI)

🌐
Stack Overflow
stackoverflow.com › questions › 65598881 › how-to-compile-c-program-in-visual-studio-code
How to compile C program in Visual Studio Code? - Stack Overflow
It will compile the code and print "Hello world!" in the terminal at the bottom ... Find the answer to your question by asking. Ask question ... See similar questions with these tags. ... You don’t understand DNS like you think you... Dispatches from O'Reilly: From capabilities to... ... Do I need to mention about a Master's programme ...
🌐
Quora
quora.com › How-do-I-set-up-vs-code-for-C-programming-I-am-a-beginner-and-need-help-with-this
How do I set up vs. code for C programming? I am a beginner and need help with this.
Answer (1 of 4): First, if you’re a Windows user, I’d recommend you download and use Visual Studio instead. The Community edition is free and is much more powerful than Visual Studio Code (which is—surprisingly—unrelated to Visual Studio). Barring that, you need at least one C Extension ...
🌐
Stack Overflow
stackoverflow.com › questions › 79048119 › how-to-run-c-in-vs-code
How to Run C in VS Code - Stack Overflow
2. Make sure the executable main.exe is mentioned in your launch.json file in the .vscode folder of your project. If you need more details check out my guide Setup Guide for C/C++ Programming on VSCode ... Save this answer. ... Show activity on this post. you should check the launch.json file. thats where the visual studio code parameters are.
🌐
Coding Campus
codingcampus.net › home › how to run a c or c++ program in vs code
How to run a C or C++ program in VS Code - Coding Campus
December 3, 2022 - This article will demonstrate the step-by-step process to get you started with running C and C++ in Visual Studio Code.