The Basic Structure of C Programs

The Basic Structure of C Programs

the basic structure of C program,the basic structure of c programs,structure of c program,structure of c , basic c structure
Structure of C Programme

[mi_box title=”NOTE:”] All Sections , Except the main( ) Function Section may be absent – as per requirement. OR when they are not required. [/mi_box]

A C Programme Contains one or more sections. These are viz.

  1. Documentation Section
  2. Link Section
  3. Definition Section
  4. Global Declaration Section
  5. main( ) function Section
  6. Sub programme Section

1 – Documentation Section

In this section we generally write Comment Line. eg. of comment line – ( /*—this is a comment —*/ )

In which we write the Name of Author , Programme Name , Date & other details , which the programmer like to use Later.

2 – Link Section

In this section , we instruct the Compiler to Link the Function from System( or C ) Library to our Programme.

3 – Definition Section

In this section we all define Symbolic Constants.

4 – Global Declaration Section

Global Variables are those variables that are used in more than one Function.

Since these Variables are used in more than One Function , that’s why we declare it in Global Declaration Section. i.e., outside the all Functions.

We also declared all the user – defined Function in this section. ( prototype declaration of function )

5 – main( ) Function Section

Every C program must have one main function.

This section contain two parts

  • Declaration part
  • Executable part

In Declaration part , we declare all the Variables that are used in executable part.

There is at-least One statement in executable part.

Both parts must appear in between { & } i.e. opening and closing Braces.

It is understood that the programme begins at opening Braces ( { ) and ends at closing Braces ( } ).

All statements in declaration and executable part must end with a Semi-colon ( ; ).

{ – opening Brace in main( ) function , denotes the Logical opening of programme.

} – closing Braces in main( ) function , denotes the Logical Ending of programme.

6 – Sub program Section

This section contains all User – defined function.

This section is placed immediately after the main( ) function.

These user defined function may appear in any Order.


[mi_box title=”NOTE:”] All Sections , Except the main( ) Function Section may be absent – as per requirement. OR when they are not required. [/mi_box]

Leave a Reply

Close Menu