I'll summarize what was explained in the video someone linked under your question, as I was able to reproduce the steps and create a working C project in Visual Studio. Kudos to the video creator and kiner_shah for sharing.

As a precondition, you shall be able to create C++ project in VS, so make sure you have the right extensions installed.

Create a new project (Shift+Ctrl+N), select Visual C++ and Console App. This will create a new console app with a default c++ main file. Remove that file and put in a main.c file. This can be compiled, and works just fine.

Answer from Daemon Painter on Stack Overflow
🌐
University of Houston-Clear Lake
sceweb.uhcl.edu › yang › teaching › csci1320fall2019 › C-VisualStudio2019.pdf pdf
To create and run a C program using Visual Studio 2019 
To create and run a C program using Visual Studio 2019 ... Once Visual Studio is started, click ‘Create a new project’. ... Select ‘Empty Project’ and click Next. ... Enter an appropriate project name. Click ‘Create’. A folder of the project name will be added ... In the Solution ...
Discussions

C programming in Visual Studio - Stack Overflow
Can I use Visual Studio to learn C programming? In the new project menu I can choose between Visual Basic, Visual C#, Visual C++, Visual F# and others but I don't see "C" or "Visual C". More on stackoverflow.com
🌐 stackoverflow.com
how to run program in c in visual studio code
Hi, I am using visual studio code version 1.107.1 (user setup). for learning programing in "C" . I need help to setup studio code, to create workspace, file and run the debug . I have setup c/c++ , c/c++run extension. I have download gcc… More on learn.microsoft.com
🌐 learn.microsoft.com
1
1
December 21, 2025
How to run a C program in Visual Studio Code? - Stack Overflow
I used to use Replit for my IDE, but I want to try Visual Studio Code (VSC) because my teacher said VSC was a great IDE to use. So I took a program I wrote a while back and put it in, but when I tr... More on stackoverflow.com
🌐 stackoverflow.com
Hi How to run a c program on visual studio community 2022?
Hi, I am a new learner, I am trying to get output from a code but the Local Window Debugger button is not there, I have tried almost every solution I could find but the solution was not there anymore for example one solution told me to go to… More on learn.microsoft.com
🌐 learn.microsoft.com
1
0
April 28, 2024
🌐
Microsoft Learn
learn.microsoft.com › en-us › cpp › build › walkthrough-compile-a-c-program-on-the-command-line
Compile a C Program on the Command Line | Microsoft Learn
There might be differences in the current directory or version numbers, depending on the version of Visual Studio and any updates installed. If the preceding output is similar to what you see, then you're ready to build C or C++ programs at the command line. ... If you get an error such as 'cl' is not recognized as an internal or external command, operable program or batch file, error C1034, or error LNK1104 when you run the cl command, then either you're not using a developer command prompt, or something is wrong with your installation of Visual Studio.
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
🌐
YouTube
youtube.com › programmertube
How to create C programs using latest Visual Studio 2019 - YouTube
In this video, I will show you the proper way to create C programs using Visual Studio 2019 For more in depth learning on C programming with Visual Studio, c...
Published   April 15, 2019
Views   175K
Find elsewhere
🌐
Visual Studio Code
code.visualstudio.com › docs › languages › cpp
C/C++ for Visual Studio Code
November 3, 2021 - C++ is a compiled language meaning your program's source code must be translated (compiled) before it can be run on your computer. The C/C++ extension doesn't include a C++ compiler or debugger, since VS Code as an editor relies on command-line tools for the development workflow.
🌐
Faircom
docs.faircom.com › doc › visual_studio_c › 78229.htm
FairCom Documentation
August 20, 2019 - FairCom Support Center helps you to find FAQ, how-to guides and step-by-step tutorials.
🌐
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 - If you are using another operating system, and you don't have the compilers installed, then make sure to install them before proceeding. You have to download Visual Studio Code directly from the official website: https://code.visualstudio.com/.
🌐
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 - In the MinGW Installation Manager, we need to check the Mingw32-base package, Ming32-gcc-g++ package and Ming32-gcc-objc package to run and compile the C/ C++ program in the visual studio code.
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)

🌐
Unstop
unstop.com › home › blog › how to run c program | step-by-step guide + detailed examples
How To Run C Program | Step-by-Step Guide + Detailed Examples
September 16, 2024 - We have given step-by-step instructions on how to run/ execute a C program with and without an IDE and in the Visual Studio code editor (e.g., VSCode).
🌐
Quora
quora.com › How-can-I-run-a-C-program-in-a-Visual-Studio-Code
How to run a C program in a Visual Studio Code - Quora
Answer (1 of 8): * You should first go to option create a new project in file menu. * Then enter the name of project press OK and accept the defaults and press finish. * Then a new terminal is opened for you on the screen . * Then you should type a syntactically correct program. [code]For exa...
🌐
Microsoft Learn
learn.microsoft.com › en-us › answers › questions › 1661018 › hi-how-to-run-a-c-program-on-visual-studio-communi
Hi How to run a c program on visual studio community 2022? - Microsoft Q&A
April 28, 2024 - You can try to create a new project by using project templates that provided by VS, and type, edit the code in newly created project, then run your program. If the code you have is from an existing project, try to get the whole project and open ...
🌐
Microsoft Learn
learn.microsoft.com › en-us › answers › questions › 475187 › how-to-build-and-run-c-source-file-opened-using-vi
How to build and run .c source file opened using Visual Studio? - Microsoft Q&A
July 14, 2021 - As far as I'm concerned, you couldn't build and run .c source file in visual studio. Visual Studio does not support this. A project is always required, even if it only contains a single source code (.c) file.
🌐
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
I installed VSC and wrote this program #include int main( void ) { printf("Hello world!"); } Then I installed a C/C++ debugger and I saved the file on the desktop as...
🌐
Reddit
reddit.com › r/cprogramming › how to setup visual studio community for c?
r/cprogramming on Reddit: How to setup Visual Studio Community for C?
March 28, 2022 -

I am beginner C programmer and I want to use Visual Studio Community as my IDE. I currently use CodeBlocks as my IDE. But, it don't have a dark mode. So I looking to use Visual Studio Community. So I went to install and it is giving some options to download some workloads. What are the options should I choose?

If I need to explain what I going to do with IDE, I am looking to create a chess game using C and add some graphics library.

🌐
Medium
ludwiguer.medium.com › configure-visual-studio-code-to-compile-and-run-c-c-3cef24b4f690
Configure Visual Studio Code to compile and run C/C++ | by Luis Guerrero | Medium
April 6, 2020 - Until here everything seems fine, but since the OUTPUT tab is read-only, we cannot interact with our code if we need to. To be able to do so, we need to tell the extension Code Runner to run our program in the TERMINAL instead of the OUTPUT tab following the next steps: