c programming structure tutorial

Bodhak c programming structure tutorial in this chapter we will discuss in detail about Structure of C program, Installing of C Compiler, Writing first C Program, Compiling, Linking, Loading and Executing the program.

The variable declaration is a part of C program and all the variables are used in main ( ) function should be declared in the local declaration section is called local variables. Not only variables, we can also declare arrays, functions, pointers etc. These variables can also be initialized with basic data types.



c programming structure tutorial:-

A structure of C program:

main ()


Local declarations;

St1 ;

st2 ;




Calling User-Defined Functions (optional)


User Defined Functions


function 2  (optional)

function n

The documentation section consists of a set of comment lines giving the name of the program, the author name and other details

The preprocessor directive starts with a # symbol. These statements instruct the compiler to include C preprocessors such as header files and symbolic constants before compiling the C program. Such as # include

The variables are declared before the main ( ) function, as well as user-defined functions, are called global variables.

These global variables can be accessed by all the user defined functions including main   ( ) function.

main ( ) function :

Each and Every C program should contain only one main ( ) function

We should write the main() function  in lowercase letters

The C program execution starts with main ( ) function.

We can not execute any C program without a main() function.

We should not be terminate main() by a semicolon.

main ( ) executes user defined program statements, library functions, and user defined functions

We Should enclose all statements within left and right braces

Every C program should have a pair of curly braces ({, }).

The left braces indicate the beginning of the main ( ) function. i.e {

The right braces indicate the end of the main ( ) function. i.e }

To indicate the user-defined functions beginning and ending, we use braces. We can also use two braces in compound statements.


Next Page