Friday, May 26, 2017

Block Structure of "C" Programs



  • Layout Structure of "C" Programs
  1.   /*Comment about the program*/
  2. Including the header files
  3. Global variables declaration
  4.   Main()
  5. {
  6. local variables declaration
  7. necessary statements
  8. }
  9. sub program funcations
function  1
function  2
  .

  ,

 function n 


1. Documentation Section

Program ke is part se hum program se related kuch point टिप्णी ke rup me likte hai. taki program ko kis liye banaya gaya hai aur program ke main point kya hai. is part me ye sab declar kiya jata hai. 

2.  Link Section   

yaha par hum "C" program ki un header files ko declar karte hai. jinko humare program ko need hai.

3. Definition Section

yaha unn variable ko define kiya jata hai. jinka program me dicectly use ho sakta hai. aur ye ek tarah se स्थिरान्क hota hai. isse global content bhi kah sakte hai.

4. Global Declaration Section

Jis kisi variable ko is setps par declear kar diya jata hai. us variable ko program me kahi par bhi use kiya ja sakta hai.

5. Main() Function Section

Yah function har "C" program me hota hai. compile karte time program control hamesa main() function ko hi dhudta hai. har "C" program me sirf ek hi main() function hota hai. kyo ki program k execution hamesa main() function ke through hota hai.

6. { Opening Parenthesis

main() function milne ke bade program ka exsivasation issi se start hota hai.

7.  Declaration Part

program me kaam ane wale sabhi variables, content, array etc. ko yahi pr declar karna hota hai. yaha par hum jise bhi declar karte hai. uske liye "C" program execution ke time memory me jagah bana dete hai. jinhe bade me apni jarurat ka according use me le sakte hai.

read hare: Type Of Programming Langauge

8. Executable Part

yaha par program ke sabhi contents hote hai. jinke through hum program se koi result lena chahte hai. yah ve part hote hai jaha se user ke liye interface ka work shuru hota hai. 

9. } Closing Parenthesis
program me dusre elements ka use karte hai. jaha par program ka last step hota hai.
   
     Sub Program
       function 1;
       function 2;
        ......
        ......
        funcation n;

program ke is part me user define function hote hai. ek main() program me main() function to ek hota hai. lekin user defined function bahut saare ho sakte hai.
So friends block Structure  ke through hi hum kisi c program ko samagh ke program create kar sakte hai. So dosto agar hum  c program ka layout ko samagh kar bhi program bana sakte hai