Visual Studio Code for C Programming
On this page (10sections)
Introduction
Visual Studio Code (VS Code) is a popular free editor for C programming. Combined with MSYS2 GCC and the C/C++ extension, it provides syntax highlighting, IntelliSense, debugging and integrated terminal support.
Step 1 — Install VS Code
Download from the official site: https://code.visualstudio.com/
Step 2 — Install a C Compiler
VS Code does not include a compiler. On Windows, install GCC via MSYS2:
- Download MSYS2 from https://www.msys2.org/
- Open MSYS2 UCRT64 terminal
- Run:
pacman -S mingw-w64-ucrt-x86_64-gcc - Add
C:\msys64\ucrt64\binto your Windows PATH
Full steps: GCC C Compiler guide
Verify in a new terminal: gcc --version
Step 3 — Install the C/C++ Extension
- Open VS Code
- Go to Extensions (
Ctrl+Shift+X) - Search for C/C++ by Microsoft
- Click Install
Extension page: https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools
Step 4 — Create and Run a C Program
- Create a folder for your project
- Create
hello.c:
#include <stdio.h>
int main(void) {
printf("Hello from VS Code!\n");
return 0;
}
- Open the folder in VS Code (
File → Open Folder) - Open the integrated terminal (
Ctrl+``) - Compile and run:
gcc hello.c -o hello
./hello
On Windows: hello.exe instead of ./hello
Optional — Debugging
Install the C/C++ Extension debug support, then create a .vscode/launch.json for GDB debugging. Microsoft provides a full walkthrough: Using GCC with MinGW in VS Code
VS Code vs Traditional IDEs
| Feature | VS Code | Code::Blocks / Geany |
|---|---|---|
| Setup | Editor + separate compiler | Often bundled compiler |
| Best for | Modern workflow, Git, extensions | Beginners, single installer |
| Debugging | Via GDB extension config | Built-in |
Related Downloads
Related Pages
- C Downloads — Browse all C Downloads.
- Code::Blocks IDE for C Programming Development — More in c ide downloads.
- Geany IDE for Windows — More in c ide downloads.
- CodeLite IDE for C and C++ — More in c ide downloads.
Frequently Asked Questions
Do I need Visual Studio to use VS Code for C?
No. VS Code is a lightweight editor. Install a separate compiler (MSYS2 GCC on Windows) and the Microsoft C/C++ extension.
Is VS Code free?
Yes. Visual Studio Code is free and open source from Microsoft.