C Install & Compiler Setup
To write and run C programs you need a compiler that translates your source code into an executable. Popular choices are GCC (GNU Compiler Collection), Clang, and MSVC on Windows.
On Linux, GCC is often preinstalled or installable via a package manager. On macOS, installing Xcode Command Line Tools gives you Clang. On Windows, MinGW or WSL are common ways to get GCC.
gcc file.c -o file
./fileInstalling GCC
On Ubuntu/Debian run `sudo apt install build-essential`. On macOS run `xcode-select --install`. On Windows, install MinGW-w64 or use WSL to get a Linux-like environment.
Editors and IDEs
VS Code with the C/C++ extension is a popular free choice. Code::Blocks and CLion are dedicated C/C++ IDEs that bundle a compiler and debugger.
gcc --versiongcc (GCC) 13.2.0Checks that GCC is installed and shows its version.
gcc hello.c -o hello
./helloHello, World!Compiles hello.c into an executable named hello, then runs it.
Key points
- GCC and Clang are the most common free C compilers.
- Compiling turns .c source files into a runnable executable.
- VS Code, Code::Blocks and CLion all support C development.
- WSL is a convenient way to get a Linux GCC toolchain on Windows.
