First C Program

Let us understand the most common beginner program. Do not just memorize it—understand what each line does.

#include <stdio.h>

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

 

Line-by-line explanation

#include <stdio.h> → Adds declarations for standard input/output functions such as printf().

int main() → Defines the main function. Program execution starts from main().

{ } → Marks the beginning and end of the function body.

printf(“Hello, World!”); → Displays the message on the screen.

return 0; → Ends main and commonly indicates successful completion.

OUTPUT
Hello, World!

 

📝 EXAM POINT: A statement in C generally ends with a semicolon (;).
Scroll to Top