BASIC STRUCTURE OF C PROGRAM
DOCUMENTATION SECTION
The documentation section consist of comments lines giving the name of the program ,details etc
PREPROCESSOR STATEMENTS
The preprocessor statements begin with #Symbol , which are also called pre processor directives.
These statements instruct the compiler to include preprocessor such as header files and symbolic constants before
Compiling the c program.
Ex .
#Include<Stdio.h>
#include<Conio.h>
#include<Math.h>
#Define P I 3.1412
GLOBAL DECLARATIONS
This variables are declared before the main() part of the function ,user defined functions are also called global variables ,
Global variables can be accessed by all the user defined function including main() function .
main() FUNCTION
Every C program should contain only one main().
Execution of C program starts with the main().
C is case sensitive and main() is written in lower case ,if you write in caps you will face the error.
The main() part of the program executes user defined functions,library function and user defined functions should be enclosed
With the left and right braces.
BRACES
Every C program should have a pair of curly braces { }
The left brace ( { ) indicate the beginning of the main() function .
Right brace ( } ) indicate the beginning of the main() function.
LOCAL DECLARATIONS
The variable declaration is part of C program ,all the variables declared are used in main() function are local variables .
We can also declare arrays,pointer ,function etc and the variable are initialised with the basic data types .
main()
{
Int sum();
Int x;
Float Y;
}
PROGRAM STATEMENTS
These statements are building blocks of C programs.
These statements instructs to perform specific task .
Statement are of different types like input statement ,output statement, control statements, assignment statement.
It also include comments , comments are not executed they are used just to understand the program.
USER DEFINED FUNCTIONS
These are sub programs,and sub programs are genrally defined as user defined functions.
This functions perform specific task and also contains set of program statements.
DOCUMENTATION SECTION
The documentation section consist of comments lines giving the name of the program ,details etc
PREPROCESSOR STATEMENTS
The preprocessor statements begin with #Symbol , which are also called pre processor directives.
These statements instruct the compiler to include preprocessor such as header files and symbolic constants before
Compiling the c program.
Ex .
#Include<Stdio.h>
#include<Conio.h>
#include<Math.h>
#Define P I 3.1412
GLOBAL DECLARATIONS
This variables are declared before the main() part of the function ,user defined functions are also called global variables ,
Global variables can be accessed by all the user defined function including main() function .
main() FUNCTION
Every C program should contain only one main().
Execution of C program starts with the main().
C is case sensitive and main() is written in lower case ,if you write in caps you will face the error.
The main() part of the program executes user defined functions,library function and user defined functions should be enclosed
With the left and right braces.
BRACES
Every C program should have a pair of curly braces { }
The left brace ( { ) indicate the beginning of the main() function .
Right brace ( } ) indicate the beginning of the main() function.
LOCAL DECLARATIONS
The variable declaration is part of C program ,all the variables declared are used in main() function are local variables .
We can also declare arrays,pointer ,function etc and the variable are initialised with the basic data types .
main()
{
Int sum();
Int x;
Float Y;
}
PROGRAM STATEMENTS
These statements are building blocks of C programs.
These statements instructs to perform specific task .
Statement are of different types like input statement ,output statement, control statements, assignment statement.
It also include comments , comments are not executed they are used just to understand the program.
USER DEFINED FUNCTIONS
These are sub programs,and sub programs are genrally defined as user defined functions.
This functions perform specific task and also contains set of program statements.
No comments:
Post a Comment