C Get Started

Install a compiler and run a program.

✍️ 2 exercises in this lesson

C code must be compiled into a program before it runs.

  1. Install a compiler: GCC (via MinGW-w64 or MSYS2 on Windows; preinstalled on most Linux), or Clang on macOS (Xcode tools).
  2. Save your code as hello.c.
  3. Compile: gcc hello.c -o hello
  4. Run: ./hello (or hello.exe on Windows).

IDEs such as Code::Blocks, CLion and VS Code (with the C/C++ extension) make this easier.

Key Takeaways: C Get Started

Mastering C Get Started helps you write clean and reliable C code. Follow standard conventions, test edge cases, and keep logic simple. Try running the code example below and complete the exercises to build confidence.

C Get Started Code Example

C
#include <stdio.h>

int main() {
    printf("Compiled with GCC and running!\n");
    return 0;
}
Output
Compiled with GCC and running!
Run this example on your own computer. The "Get Started" lesson shows how to set it up.

C Get Started Practice Exercises

Check what you learned in “C Get Started”.

/ 2 solved
Fill in the blank

Compile hello.c into a program called hello with GCC.

 hello.c -o hello
✓ Correct! Not quite. Try again.
Multiple choice

What must happen before a C program can run?

✓ Correct! Not quite. Try again.
to save your exercise progress.
Finished this lesson?
Mark it complete to track your progress.

Stuck on something?

Ask the community in the CodesInTech forum.

Need a developer?

Learning on your own is great — and when you need professional help, our team builds custom software, websites and mobile apps for clients worldwide.

Explore Our Services