Setting Up C Environment

πŸ“˜ C πŸ‘ 37 views πŸ“… Dec 22, 2025
⏱ Estimated reading time: 1 min

Setting Up C Environment

To write and run C programs, the following components are required:

  1. C Compiler

  2. Text Editor or IDE


Step 1: Install a C Compiler

A compiler translates C source code into machine code.

Common C Compilers

  • GCC (GNU Compiler Collection) – Most widely used

  • Clang

  • Turbo C (for academic/legacy use)


Windows

  1. Download and install MinGW or Code::Blocks (with GCC)

  2. Add the compiler’s bin folder to the System PATH

  3. Verify installation:

gcc --version

Linux

  1. Open terminal

  2. Install GCC:

sudo apt update sudo apt install gcc
  1. Verify:

gcc --version

macOS

  1. Install Xcode Command Line Tools:

xcode-select --install
  1. Verify:

gcc --version

Step 2: Choose a Text Editor or IDE

Text Editors

  • Notepad / Notepad++

  • VS Code

  • Sublime Text

IDEs

  • Code::Blocks

  • Dev-C++

  • Visual Studio (with C tools)


Step 3: Write a C Program

Create a file with .c extension.

#include int main() { printf("Hello, C!"); return 0; }

Step 4: Compile the Program

gcc program.c -o program

Step 5: Run the Program

Windows

program

Linux / macOS

./program

Summary

  • Install a C compiler (GCC recommended)

  • Use a text editor or IDE

  • Write code in .c file

  • Compile using gcc

  • Execute the compiled program



πŸ”’ Some advanced sections are available for Registered Members
Register Now

Share this Post


← Back to Tutorials

Popular Competitive Exam Quizzes