English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

C Language Basic Tutorial

C Language Flow Control

C Language Functions

C Language Arrays

C Language Pointers

C Language Strings

C Language Structure

C Language File

C Others

C Language Reference Manual

C Entry Program Hello, World!

Comprehensive Collection of C Programming Examples

In this example, you will learn to print 'Hello, World!' on the screen of C language programming.

The program displays 'Hello, World!"

#include <stdio.h>
int main() {
   //printf() displays the string within the quotes
   printf("Hello, World!");
   return 0;
}

Output result

Hello, World!

How does the 'Hello, World!'' program work?

  • #include is a preprocessor command that tells the compiler to include the content of the stdio.h (standard input and output) file in the program.

  • The stdio.h file includes functions such as scanf() and printf(), which are used to obtain input and display output.

  • If you use the printf() function under the condition of using #include <stdio.h>, the program will not compile.

  • The execution of a C program begins with the main() function.

  • printf() is a library function used to send formatted output to the screen. In this program, printf() displays the text "Hello, World!" on the screen.

  • The return 0; statement is the program's“Exit Status”In simple terms, the program ends with this statement.

Comprehensive Collection of C Programming Examples