Storage Class in C language




















Storage class:-

Every variable of 'C' language have a data type and a storage class. Data type of a variable shows which type of value will store in variable and how many bytes this variable will take in computer memory. Whereas storage class will provide following important information related with the variable -
1. In which type of memory (container), variable is placed.
2. Initial value of variable.
3. Scope of variable.
4. Life of variable.
"A class which is used to represent variables location, by default initial value, scope and life is called storage class."

เคธी เคฒैंเค—्เคตेเคœ เค•े เคช्เคฐเคค्เคฏेเค• เคตेเคฐिเคเคฌเคฒ เค•ा เคกाเคŸा เคŸाเค‡เคช เคเคตं เคธ्เคŸोเคฐेเคœ เค•्เคฒाเคธ เคนोเคคी เคนै, เคตेเคฐिเคเคฌเคฒ เค•ा เคกाเคŸा เคŸाเค‡เคช เค‰เคธ เคตेเคฐिเคเคฌเคฒ เคฆ्เคตाเคฐा เคฐाเค–ी เคœाเคจे เคตाเคฒी เคตैเคฒ्เคฏू เค•े เคช्เคฐเค•ाเคฐ เคเคตं เคฎेเคฎोเคฐी เคธाเค‡เฅ› เค•ो(เคฌाเค‡เคŸ เคฎें) เคฆเคฐ्เคถाเคคा เคนै เคœเคฌเค•ि เคธ्เคŸोเคฐेเคœ เค•्เคฒाเคธ เคตेเคฐिเคเคฌเคฒ เคธे เคธเคฎ्เคฌंเคงिเคค เคจिเคฎ्เคจ เคฎเคนเคค्เคตเคชूเคฐ्เคฃ เคœाเคจเค•ाเคฐी เคช्เคฐเคฆाเคจ เค•เคฐเคคी เคนै -
1. เคตेเคฐिเคเคฌเคฒ เค•ो เค•िเคธ เคฎेเคฎोเคฐी (เค•ंเคŸेเคจเคฐ) เคฎें เคฐเค–ा เคœाเคฏेเค—ा 
2. เคตेเคฐिเคเคฌเคฒ เค•ा เคช्เคฐाเคฐंเคญिเค• เคฎाเคจ เค•्เคฏा เคนोเค—ा 
3. เคตेเคฐिเคเคฌเคฒ เค•ा เคธ्เค•ोเคช เค•เคนाँ เคคเค• เคนोเค—ा 
4. เคตेเคฐिเคเคฌเคฒ เค•ी เคฒाเค‡เคซ เค•เคฌ เคคเค• เคฐเคนेเค—ी 
เค…เคคः เคตเคน เค•्เคฒाเคธ เคœो เคตेเคฐिเคเคฌเคฒ เค•े เคฎेเคฎोเคฐी , เคช्เคฐाเคฐंเคญिเค• เคฎाเคจ , เคธ्เค•ोเคช เคเคตं เคฒाเค‡เคซ เค•ी เคœाเคจเค•ाเคฐी เคฆेเคคी เคนै เคธ्เคŸोเคฐेเคœ เค•्เคฒाเคธ เค•เคนเคฒाเคคी เคนै।   
    
'C' language uses following four storage classes -
เคธी เคฒैंเค—्เคตेเคœ เคฎें เคจिเคฎ्เคจ เคšाเคฐ เคธ्เคŸोเคฐेเคœ เค•्เคฒाเคธ เคช्เคฐเคฏुเค•्เคค เค•ी เคœाเคคी เคนै -

1.) Automatic storage class:-
Automatic storage class uses auto keyword for preparing a variable. Variable of this storage class will be stored in computer memory. Its by default initial value is garbage. Scope and life of this variable are local to the block. Generally all local variables are automatic storage class variable.
เค†เคŸोเคฎेเคŸिเค• เคธ्เคŸोเคฐेเคœ เค•्เคฒाเคธ เค‘เคŸो เค•ीเคตเคฐ्เคก เค•ा เคช्เคฐเคฏोเค— เค•เคฐ เคตेเคฐिเคเคฌเคฒ เคคैเคฏाเคฐ เค•เคฐเคคी เคนै। เค‡เคธ เคธ्เคŸोเคฐेเคœ เค•्เคฒाเคธ เค•े เคตेเคฐिเคเคฌเคฒ เค•ंเคช्เคฏूเคŸเคฐ เคฎेเคฎोเคฐी เคฎें เคธ्เคฅाเคจ เค—्เคฐเคนเคฃ เค•เคฐเคคे เคนै। เค‡เคจ เคตेเคฐिเคเคฌเคฒ्เคธ เค•ा เคช्เคฐाเคฐंเคญिเค• เคฎाเคจ เค—ाเคฐ्เคฌेเคœ(เค•ूเฅœा-เค•เคšเคฐा) เคนोเคคा เคนै। เค‡เคจ เคตेเคฐिเคเคฌเคฒ เค•ा เคธ्เค•ोเคช เคเคตं เคฒाเค‡เคซ เคธเคฎ्เคฌंเคงिเคค เคฌ्เคฒॉเค• เคคเค• เคธिเคฎिเคค เคนोเคคी เคนै। เคธเคญी เคฒोเค•เคฒ เคตेเคฐिเคเคฌเคฒ, เค‘เคŸो เคธ्เคŸोเคฐेเคœ เค•्เคฒाเคธ เค•े เคตेเคฐिเคเคฌเคฒ เคนोเคคे เคนै      
Example :-
auto int a;
int a; (inside the block)

2.) Static storage class:-
Static storage class uses static keyword for preparing a variable. Variable of this class will be stored in computer memory.  Its by default initial value is zero. Scope of this variable is local to the block and its life is remain until the function calling completed. Hence static variable are used to maintain single copy of variable and to perform different function calling in a program.
เคธ्เคŸेเคŸिเค• เคธ्เคŸोเคฐेเคœ เค•्เคฒाเคธ เคธ्เคŸेเคŸिเค• เค•ीเคตเคฐ्เคก เค•ा เคช्เคฐเคฏोเค— เค•เคฐ เคตेเคฐिเคเคฌเคฒ เคคैเคฏाเคฐ เค•เคฐเคคी เคนै। เค‡เคธ เคธ्เคŸोเคฐेเคœ เค•्เคฒाเคธ เค•े เคตेเคฐिเคเคฌเคฒ เค•ंเคช्เคฏूเคŸเคฐ เคฎेเคฎोเคฐी เคฎें เคธ्เคฅाเคจ เค—्เคฐเคนเคฃ เค•เคฐเคคे เคนै। เค‡เคจ เคตेเคฐिเคเคฌเคฒ्เคธ เค•ा เคช्เคฐाเคฐंเคญिเค• เคฎाเคจ เคถूเคจ्เคฏ เคนोเคคा เคนै। เค‡เคจ เคตेเคฐिเคเคฌเคฒ เค•ा เคธ्เค•ोเคช เคเคตं เคฒाเค‡เคซ เคตिเคญिเคจ เคซंเค•्เคถเคจ เค•ाเคฒिंเค— เค•े เคฆौเคฐाเคจ เคฌเคจी เคฐเคนเคคी เคนै। เค…เคคः เคช्เคฐोเค—्เคฐाเคฎ เคฎें เค‡เคจ เคตेเคฐिเคเคฌเคฒ्เคธ เค•ी เค•ेเคตเคฒ เคเค• เคนी เค•ॉเคชी เคนोเคคी เคนै เคเคตं เค‡เคจเค•ा เคช्เคฐเคฏोเค— เคซंเค•्เคถเคจ เค•ाเคฒिंเค— เค•े เคฒिเค เค•िเคฏा เคœाเคคा เคนै 
Example :-
static int a;

3.) Register storage class:-
Register storage class uses register keyword for preparing variable. Variable of this class will be stored in CPU register. Its by default initial value is garbage.  Scope and life of this variable is local to the block.  Register variable are used for storing of frequently used data and it will increase the performance of program. 
เคฐเคœिเคธ्เคŸเคฐ เคธ्เคŸोเคฐेเคœ เค•्เคฒाเคธ เคฐเคœिเคธ्เคŸเคฐ เค•ीเคตเคฐ्เคก เค•ा เคช्เคฐเคฏोเค— เค•เคฐ เคตेเคฐिเคเคฌเคฒ เคคैเคฏाเคฐ เค•เคฐเคคी เคนै। เค‡เคธ เคธ्เคŸोเคฐेเคœ เค•्เคฒाเคธ เค•े เคตेเคฐिเคเคฌเคฒ เคธी.เคชी.เคฏू. เคฐเคœिเคธ्เคŸเคฐ เคฎें เคธ्เคฅाเคจ เค—्เคฐเคนเคฃ เค•เคฐเคคे เคนै। เค‡เคจ เคตेเคฐिเคเคฌเคฒ्เคธ เค•ा เคช्เคฐाเคฐंเคญिเค• เคฎाเคจ เค—ाเคฐ्เคฌेเคœ(เค•ूเฅœा-เค•เคšเคฐा) เคนोเคคा เคนै। เค‡เคจ เคตेเคฐिเคเคฌเคฒ เค•ा เคธ्เค•ोเคช เคเคตं เคฒाเค‡เคซ เคธเคฎ्เคฌंเคงिเคค เคฌ्เคฒॉเค• เคคเค• เคธिเคฎिเคค เคนोเคคी เคนै। เคฐเคœिเคธ्เคŸเคฐ เคตेเคฐिเคเคฌเคฒ เค•ा เคช्เคฐเคฏोเค— เค…เคค्เคฏเคงिเค• เคช्เคฐเคฏोเค— เคฎें เคฒाเคฏे เคœाเคจे เคตाเคฒे เคกाเคŸा เค•ो เคธंเค—्เคฐเคนिเคค เค•เคฐเคจे เค•े เคฒिเค เค•िเคฏा เคœाเคคा เคนै เคœिเคธเคธे เคช्เคฐोเค—्เคฐाเคฎ เค•ा เคชเคฐเคซॉเคฐ्เคฎेंเคธ เคฌเฅ เคœाเคคा เคนै        
Example :-
register int a;

4.) External storage class:-
External storage class uses extern keyword for preparing a variable.  Variable of this storage class will be stored in computer memory.  Its by default initial value is zero.  Scope of this variable is global and its life is remain until the program completed. External storage class are used to prepare global variable which utilizes computer memory.
เคเค•्เคธเคŸเคฐ्เคจเคฒ เคธ्เคŸोเคฐेเคœ เค•्เคฒाเคธ เคเค•्เคธเคŸเคฐ्เคจ เค•ीเคตเคฐ्เคก เค•ा เคช्เคฐเคฏोเค— เค•เคฐ เคตेเคฐिเคเคฌเคฒ เคคैเคฏाเคฐ เค•เคฐเคคी เคนै। เค‡เคธ เคธ्เคŸोเคฐेเคœ เค•्เคฒाเคธ เค•े เคตेเคฐिเคเคฌเคฒ เค•ंเคช्เคฏूเคŸเคฐ เคฎेเคฎोเคฐी เคฎें เคธ्เคฅाเคจ เค—्เคฐเคนเคฃ เค•เคฐเคคे เคนै। เค‡เคจ เคตेเคฐिเคเคฌเคฒ्เคธ เค•ा เคช्เคฐाเคฐंเคญिเค• เคฎाเคจ เคถूเคจ्เคฏ เคนोเคคा เคนै। เค‡เคจ เคตेเคฐिเคเคฌเคฒ เค•ा เคธ्เค•ोเคช เคเคตं เคฒाเค‡เคซ เคช्เคฐोเค—्เคฐाเคฎ เค•े เคชूเคฐ्เคฃ เคนोเคจे เคคเค• เคฌเคจी เคฐเคนเคคी เคนै। เค…เคคः เคเค•्เคธเคŸเคฐ्เคจเคฒ เคธ्เคŸोเคฐेเคœ เค•्เคฒाเคธ เค•ा เคช्เคฐเคฏोเค— เค—्เคฒोเคฌเคฒ เคตेเคฐिเคเคฌเคฒ เคคैเคฏाเคฐ เค•เคฐเคจे เค•े เคฒिเค เค•िเคฏा เคœाเคคा เคนै เคœिเคธเคธे เค•ंเคช्เคฏूเคŸเคฐ เคฎेเคฎोเคฐी เค•ा เคช्เคฐเคญाเคตी เค‰เคชเคฏोเค— เคนोเคคा เคนै 
Example :-
extern int a;
int a; (outside the block)

Comments

Popular posts from this blog

C Language Topics in Hindi and English

C language IMP Questions for BSc/BA/BCom/BCA/BE/BTech/MSc/MCA (CS/IT) I year students