Hi, guest ! welcome to fresherscampus.com. Hot on campus | Campus Review

STRUCTURE OF C PROGRAM --Find more at Programming


                                           Structure of C programs with detailed explanation:

Include header file section

Global declaration section

/*comments*/

main()    /*function  name*/

{

/*comment*/

Declaration part

Execution part

}

User-defined functions

{

Statements

}

 

Include header file section:-

C program contain the header file section for function definition that are used in the program.

Each header file extended with .h ,and included with #include.

Eg:- #include <stdio.h> 

Global declaration section:-

                In this section declares the variable that used more than one function .This variable must be declare outside of the function.

Function main:-

                 Each and every program written in the c language must begin with main () function  The main () is the starting point of the program .The program execution is start from the open brace ( { ) and ends with close brace ( } ). In between this two brace the program should declare the declaration and executable part.

Declaration part:-

                  In this declaration section all the variables are declared that are used in the executable part. Initializations also done in this section Initialization means giving the initial value to the variables.

Executable part:-

This part contains the statements following the declaration part .These statements are enclosed between the brace.

User-defined function:-

The function that are defined by the user are called user defined function .it is not compulsory.

Comments:-

                 The comments are used to understand the flow of programs that are not necessary.

Comments are nothing but some kind of statement that are placed between the delimiters /*&*/.

Eg:-  /* simple addition program*/


Your Response

good test

#1 
By Atul Sharma on April 19th, 2012 @ 5:53 PM

Add a Comment

required, use real name
required, will not be published

Engineering   Campus Tips   Exam Preparation   Placement Tips   Online Mock Test
Anna University
Question Bank
Campus Studies
Exam Results
Preparation Tips
Placement papers
Programing Test
Aptitude Test
IT Interview test
Sitemap   |    Submit Tips   |    Privacy Policy   |    Contact Us