Cài đặt máy tính của bạn
Trang này cần trình duyệt gần đây (hỗ trợ SharedArrayBuffer). Vui lòng cập nhật Chrome, Edge, Firefox hoặc Safari lên phiên bản mới nhất.
English
Run C on your own computer
- This playground is great for learning — your code is built and run for you.
- For your own projects, it helps to set C up on your computer.
- It takes about 15 minutes, and you only do it once.

English
Step 1 — Install a compiler
- A compiler turns your C code into a program the computer can run.
- Windows: install MSYS2 from msys2.org. Then open the MSYS2 UCRT64 window, run
pacman -S mingw-w64-ucrt-x86_64-gccto getgcc, addC:\msys64\ucrt64\binto your PATH, and restart VS Code. - macOS: open Terminal and run the command below to get
clang. - Linux: install
build-essential, which includesgcc.
xcode-select --install
English
Step 2 — Install VS Code
- VS Code (Visual Studio Code) is a free, popular code editor from Microsoft.
- Get it from code.visualstudio.com and install it.
- This is where you will write your code.
English
Step 3 — Add the C/C++ extension
- Open VS Code and click the Extensions icon on the left.
- Search for C/C++ (the one by Microsoft) and click Install.
- It adds colours, error hints, and a debugger for C.
English
Step 4 — Check the compiler works
- Open a terminal (in VS Code: Terminal → New Terminal) and type:
gcc --version
- You should see a version line. If you do, your compiler is ready.
English
Step 5 — Compile and run your first file
- Make a new file called
hello.cand type this in:
#include <stdio.h>
int main(void) {
printf("Hello from my own computer!\n");
return 0;
}
- In the terminal, build it and then run it:
gcc hello.c -o hello
./hello
- You just compiled and ran C outside the browser.