C : The basic structure

If you are reading this than that means you know something about programs.
There are many types of program each of which may work differently .Despite of all the different kind of programs that we use there is a common structure that is followed by all the programs .In this post we will try to understand the basic structure that a c program follows.

 

Capture

 

Basic Structures and their brief explanation

Documentation section –
It is mainly the section which includes Title/Name/Summary or any Info about the proggram

Link section –
It links the Compiler to the system library .
Ex:-  #include<stdio.h>

Definition section-
Usually defines the constant that we may need in a program .
Ex:- #define Constant 180

Global Declaration section-
A globally declared variable can be accessed by multiple functions .Suppose, “int i=4;” is a globally declared variable which can be accessed by all the functions in that program.

Main() function section-
It is the actual main body of a program. All the statements are declared here. Main function has two parts, Declaration function which declares the variables and the Executable part which includes the execution commands.

main()
{
Declaration Part
 Execution Part
}

Other than that some times a program includes Other than that some times a program includes –

Sub Program section
Mainly includes user defined functions

 

Things that should be followed-
*Using braces({}) are important as they declares the beginning and ending of a program *All the statements must end with semicolon (;)
*C is case sensitive so it is wise to keep that in mind
*Indentation makes the program easier to understand and makes it look smooth

 

Leave a comment

Website Powered by WordPress.com.

Up ↑

Design a site like this with WordPress.com
Get started