C language hello world

Written by


First C Program


Come on, guys ! Lets write our first C program to print Hello World on screen :

 #include &ltstdio.h>
    int main()
printf("Hello World !");

return 0;

Output :

Hello World !

The C program is made up of following parts:


Pre-processor : #include tells the compiler to include a file and #include&ltstdio.h> tells the compiler to include stdio.h header file to the program.

Header File : A header file is a file with extension .h and it contains built-in functions, which can be directly used in an program.

For example : We use printf() function in a program to print data on screen. This function is available in stdio.h header file.

main() function : main() is an important part of a C program. Program execution begins from main() function.

Here, we have written int before the main() as it is the return type of of main().

Comments : A large program can be complex and hard to understand. So, to solve this problem we use comments in C.

Single line comment:

// comments goes here

Multi line comment:

 *  Comment goes here

return 0 : This indicates finishing of a function.
When we wrote our main() function, we used int before it. That int was the return type, so with statement return 0, we are returning a null value to the operating system, this will prevent our program from errors.

Now, save the program with .c extension and run in a compiler(like codeblocks ).

C language hello world