C Language HelloWorld

Hello World in C

Introduces how to create a HelloWorld program in the C programming language. int main(int argc, char *args[]) { printf("Hello, world!n"); return 0; } EOT...

Shou Arisaka
2 min read
Oct 10, 2025

Introduces how to create a HelloWorld program using the C language. This article explains in detail the steps to create a HelloWorld program in C, compile it, and execute it.

Creating a HelloWorld Program

First, let’s create a HelloWorld program in C. Below is how to write a C HelloWorld script in a file named hello.c.

#include <stdio.h>

int main(int argc, char *args[])
{
    printf("Hello, world!\n");
    return 0;
}

This C program includes the stdio.h header file and uses the main function to output the message “Hello, world!”. Finally, it terminates the program with return 0.

Compilation

After writing the HelloWorld program, next compile the program. Compiling a C program generates an executable binary file. Below are commands to compile a C program.

gcc -o hello hello.c
gcc hello.c -o hello.exe

The first command uses the gcc compiler to compile hello.c into an executable file named hello. The second command is for compiling an executable file for Windows environments.

Running the Program

Once compilation is complete, you can run the HelloWorld program. Below is how to run a program written in C.

./hello

Running this command will display the message “Hello, world!” in the console.

Share this article

Shou Arisaka Oct 10, 2025

🔗 Copy Links