First C Program, Hello World

Recommended Topics Before You Continue :

  1. How to compile C programs*
  2. Structure of C Program
Your first C program is given below:
#include <stdio.h>

int main()
printf("Hello World!");

return 0;
Output: Hello World!

What does this program do?

This program displays Hello World! on the standard output console (i.e your monitor).


Here main() is function. Every C program must contain a main() function. int is the return_type of main function. We will discuss more about return_type later. main function contains two statements. Every statement in C end with a semicolon(;).

printf() is output function. Whatever you put in double quotes it gets displayed as it is on your console.

return 0; returns value zero to the system. It simply means that the program executed successfully.

Tada! You just wrote your first C program. You started your journey towards programming. Comment if you have any problem and keep Learning to know more.

Prev - Structure of C Program Next - Comments In C