Pages

Friday, 16 December 2016

Structure of a C program || C program Body

Structure of a Program:

C program consists of mainly 5 parts:

*  Preprocessor directives (header files), Global declarations.

*  Main function.

* A pair of braces( before starting main function and remaining at the end) .

*Set of Statements(local declarations,user statements)

* User defined functions(if any).

What are these components?  😕

Don't worry have a look on simple C program :

Preprocessor directives: These are also called as header files.These files includes the every information of the prototypes.Example:Standard i/p & o/p header (stdio) contains information and how to process the prototypes such as printf(); scanf(); etc.... 

Main function: it is the main part of the program.Always the C compiler executes the statements of main function. Example: void main(),int main().
Pair of braces:These braces are used to separate the set of statements as main function and user defined functions.
Set of statements:These are the collections of  statements designed by the programmer to do a specific task.
User defined functions: These are set of programmer defined statements.Programmers use this to do a special task. Rather than main function we can use custom functions according to
our requirements. 

Have a daily look on blog to get more stuffs.

0 comments:

Post a Comment