How to Run C Program

To run a C program, you need a C compiler. GCC is one of the most commonly used C compilers.

Method 1: GCC on Windows

  1. Install a GCC toolchain such as MinGW-w64.
  2. After installation, make sure the compiler’s bin folder is available in PATH.
  3. Open Command Prompt.
  4. Type the following command:
gcc –version
  1. If a GCC version appears, the compiler is ready.

Create and run your first file

hello.c

#include <stdio.h>

int main() {
printf(“Hello, C!”);
return 0;
}

 

Save the file as hello.c. Then compile it:

gcc hello.c -o hello

 

Run it. On Windows, the executable is normally hello.exe. On Linux/macOS, you can usually run:

./hello

 

OUTPUT
Hello, C!

 

⭐ EASY TIP: An IDE such as Code::Blocks or Visual Studio Code is an editor/development environment. The actual compilation is done by a compiler such as GCC.
Scroll to Top