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 statement begins with the # symbol and is also called the preprocessor directive. 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 ( ).

The C program execution starts with main ( ) function.

No C program is executed without the main function.

the main ( ) function should be written in lowercase letters

main()should not be terminated by a semicolon.

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

All the statements should be enclosed 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 }

The braces can also be used to indicate the user-defined functions beginning and ending.The two braces can also be used in compound statements