'C' program Structure : First 'C' Program ''Hello World"

 C program Structure

Ø C program consist of one or more than one functions but main() is the function which must be there in every C Program.

Ø The first function called up during C program execution is main () function.

Ø C program consist of following basic parts or sections

1. C preprocessor Commands

2. Functions (At least main)

3. Variables

4. Statements & Expressions

5. Comments



  General Structure of C Program :

//C preprocessor directives section

//Global data declaration section

main()   //main function

{

    //Declaration section;

  

    //Program statements;

}

 

 // User defined functions

funct1()

{

  …………..

  …………..

}

                                            

funct2()

{

  …………..

  …………..

}



First C program (hello.c)


Program1:/*C program to print a Hello World */


      #include<stdio.h>               //header file

        main( )                            //main function

        {

         printf(“Hello World ”);   //output statement       

         return 0;           //returning value to function                                                                                                                                                      

         }


   Output:

                  Hello World


Comments

Post a Comment

Popular posts from this blog

History of "C" Programming Language

What is program Editing/Compiling/Error checking/Executing/Testing/Debugging?