adplus-dvertising

C Hello World program

frame-decoration

C Hello World program

Problem Description

Hello World! program is the basic program to get started with any programming language. It is use to demonstrate the basic syntax of a programming language. This program simply prints Hello World! on the screen.

C Hello World program - Source code
     
                
  #include<stdio.h>

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

Program Output

Hello World!

Program Explanation

Generally, C programs start with the inclusion of header files. Here we include the stdio.h (standard input output) header file because we have used printf function in our program. These header files are also called as preprocessor commands. The stdio.h header file includes inbuilt functions for input and output like printf, scanf, etc. If you try to use printf function without writing the stdio.h header file, the compiler will throw an error.

The execution of a C program starts at the main function. The int before the keyword main is the return type(integer in this case).

The printf function output on the screen whatever is written in the double quotes. The program ends when it encounter a return statement. Here we are existing the program by returning 0 to the operating system.