First Program in C language Print Hello World

#include <stdio.h>
void main()
 printf("Hello World");

To print hello world firstly we include standard input output header file (Line 1). Secondly we need to have a main() function from where our program execution starts, as main function doesn’t return any value we used void as the return type. Then in the body of main function we use printf() function and mention hello world in quotes. Finally don’t forget to place a semicolon at the end of line 4.

To compile the program 1.c we use command – gcc 1.c and after that a executable file is generated “a” in our case, so in next step we just enter the name of executable file and press ENTER. Hello World is printed.

Leave a Reply

Your email address will not be published. Required fields are marked *