Home C C++ Java Python Perl PHP SQL JavaScript Linux Selenium QT Online Test

Home » C Programming » Tutorial » Hello World in C

The first C program - Hello World

We can start our first C program by printing "Hello World" as output. One we grow we can print multiple things on screen. Please follow our tutorial step by step to dive into C programming.


#include<stdio.h>

int main()
{
printf("Hello World");
return 0;
}

Breakup of "Hello World" Program

#include - Whaterver starts with '#', it is processed by preprocessor and it is known as preprocessor directive.
< stdio.h > - header file is sorrounded by <> angular bracket. We can also use like "stdio.h" but angular bracket one is faster.
int - Here void is return type of main() function. Return type can be any data type.
main() - main() is a function which is must to execute any program. It is case sensitive.
{ } - These are called braces, opening and closing braces.
printf() - printf() is library function which is used to print somethign console.
Hello World - "Hello World" is string here; instead of this you can put any string.


int main()
{
printf("Hello World");
printf("\n Program by CppBuzz.com");
return 0;
}

Here '\n' is known as single line character. It prints the text in new line.

Main() function returning int value

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

return 0;
}

Here int is used inpalce of void. Since we have used int as return type so we have to return some it value from main() function.