Basic structure and Illustrated Version of Basic C program:

Basic Structure of a C program:

 


                    Preprocessor directives
                   
                    Global declarations

    int main (void)
    {
                     Local Declarations

                    Statements
     return 0;
     }

Preprocessor Directives: 

  •  In C, the C preprocessor executes before a program is compiled
  • The Preprocessor Directives begin with "#"
  • It is having 3 types of preprocessor directives are Macros, Inclusion of other files in the file being compiled, and Condition Compilation of a C code.

Global Declarations:

  • We are declaring this Global variable outside of any function.
  • accessed by any statement in the entire program.
  • stored on a fixed location decided by a compiler.
  • This part is used to declare the variables which are common for multiple/global/universal methods. 

Local Declaration:

  • Declare inside the function, that is we are declaring within the local variables within the part of the function block.
  • These variables have local scope to that the function only, which they are declared.
  • They cannot be accessed outside the function Block.


A Clear Verison of a Basic  program explained in a detailed way in the Below Picture:


Illustrated Version is referred from 2nd edition of pradip dey, manas gosh's computer fundamentals and programming In Book

Reference

Post a Comment

0 Comments