Hello World Program in C


This is a C program which will enable us to display Hello World on the screen
so, let's understand the program coded below as this is your first program if you are 
going through this article don't worry you'll be addressed even  a single full stop, 
so enjoy and code.

Displaying Hello World

  #include<stdio.h>

   int main()

  {

   /* printf function enables the text to display on the

       screen which is written between the  double quotes */

  printf("Hello world");

  return 0;

    }


Output:


1. #include<stdio.h> --  This statement tells the compiler that while running this

program include stdio.h file which is predefined . This is a standard input output

file which has function like printf() and scanf() which perform their specific tasks

in this program we are using printf() that's why have included stdio.h file.


2. int main() -- This statement includes two things return type int and main function

 return type tells the program that this function will return integer type value and 

every program has this function because the execution of the program begins with

the main() function. The 0 return value of this function represents the successful execution

of the program while 1 return value means unsuccessful execution.  


3.  /* example */ --  This is a multi-line comment which can be used to make program

 more detailed and easily understandable you can use it anywhere in the program. This

is used if you want to write comment in multiple lines.


4. printf("Hello World"); -- This function enables the program to display the content 

written within double quotes. and ; this symbol designates the end of statement.


5. return 0; -- As given above , the value 0 means successful execution of main()

function. 

                                                         << Back

Post a Comment

Previous Post Next Post