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
Post a Comment