C Program to Print Hello, World!
This is the first program most beginners write when learning C programming. It simply displays the text 'Hello, World!' on the screen using the printf() function.
Concept Overview
In C, the `printf()` function is used to print output to the console. The program must include the header file `stdio.h` (Standard Input Output Header) to use printf(). Every C program begins execution from the `main()` function.
Program
C
#include <stdio.h>
int main() {
printf("Hello, World!\n");
return 0;
}
Output
Hello, World!
Explanation
- `#include
` – Includes the standard input-output library required for using printf(). - `int main()` – The entry point of every C program.
- `printf("Hello, World!");` – Displays the message on the screen.
- `return 0;` – Indicates that the program ended successfully.
Note: Note: Every C statement ends with a semicolon `;`. The output is printed inside double quotes using printf().
Codecrown