SlideShare ist ein Scribd-Unternehmen logo
1 von 15
NITESH KUMAR PANDEY
STORAGE CLASS

 The storage class determines the part of the memory
  where the variable would be stored.
 The storage class also determines the initial value of
  the variable.
 and it used to define the scope and lifetime of
  variable.
 There are two storage location in computer :
   CPU Registers and Memory
CPU REGISTER AND MEMORY

 A value stored in a CPU register can always be
 accessed faster then the one that is stored in
 memory.
TYPES OF STORAGE CLASSES

There are four types of storage classes in C:
i.   Automatic storage class
ii.   Register storage class
iii.  Static storage class
iv.   External storage class
Automatic Storage Class

 Keywords                : auto.
 Storage                  : memory.
 Default initial value     : garbage value.
 Scope                     : local to the block in
                                which the variable is
                                defined.
 Life                     : till the control remains
                                within the block in which
                                the variable is defined.
Example of Automatic Storage Class

#include<stdio.h>
#include<conio.h>
void main()
{
auto int i=1;
{
auto int i=2;
{
auto int i=3;
printf(“n%d”,i);
}
printf(“%d”,i);
}
printf(“%d”,i);
getch();
}

Output:
3 2 1
Register Storage Class

 Keywords                : register.
 Storage                  : CPU Register.
 Default initial value   : garbage value.
 Scope                   : local to the block in
                             which the variable is
                              defined.
 Life                     : till the control remains
                                within the block in which
                                the variable is defined.
Example of Register Storage Class

#include<stdio.h>
#include<conio.h>
void main()
{
register int i;
for(i=1;i<=10;i++)
printf(“ %d",i);
getch();
}
Output:
1 2 3 4 5 6 7 8 9 10
Register Storage Class

 If the microprocessor has 16-bit registers then they
  cannot hold a float value or a double value which
  requires 4bytes(32-bit) and 8 bytes(64-bit)
 If you want to use the register storage class(16-bit
  microprocessor) with float and double variable then
  you won‟t get any error messages. Your compiler
  would treat the variables as auto storage class.
Static Storage Class

 Keywords                : static.
 Storage                  : memory.
 Default initial value     : zero.
 Scope                     : local to the block in
                              which the variable is
                              defined.
 Life                     : value of the variable
                               persists between different
                               function calls.
Dif. b/w auto and static storage class

Automatic                   Static

#include<stdio.h>           #include<stdio.h>
#include<conio.h>           #include<conio.h>
increment();                increment();
void main()                 void main()
{                           {
increment();                increment();
increment();                increment();
increment();                increment();
}                           }
increment()                 increment()
{                           {
auto int i=1;               static int i=1;
printf("%dt",i);           printf("%dt",i);
i++;                        i++;
getch();                    getch();
}                           }
Output:                     Output:
1 1           1             1      2       3
External Storage Class

 Keywords                 : extern.
 Storage                 : memory.
 Default initial value   : zero.
 Scope                   : global.
 Life                     : as long as the program‟s
                             execution doesn‟t come
                              to an end.
• The  different b/w two programs 1st auto and 2nd
static storage class for variable „i‟ the scope of
auto and static both use local to the block in witch
the variable is declared.
• Those program consists two functions main() and
increment().
• The increment() function called from main()
function for three times.
• Each time increment the value of „i‟ and print.
• when variable „i‟ is auto each time increment and
re-initialized to 1.
Example of External Storage Class
#include<stdio.h>
#include<conio.h>
int i =1;
increment();
void main()
{
printf("%dt",i);
increment();
increment();
getch();
}
increment()
{
i++;
printf("%dt",i);
}
Output:
1 2       3
Storage class in C Language

Weitere ähnliche Inhalte

Was ist angesagt?

Operator Overloading
Operator OverloadingOperator Overloading
Operator OverloadingNilesh Dalvi
 
Constructors and destructors
Constructors and destructorsConstructors and destructors
Constructors and destructorsNilesh Dalvi
 
INTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMINGINTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMINGAbhishek Dwivedi
 
FUNCTIONS IN c++ PPT
FUNCTIONS IN c++ PPTFUNCTIONS IN c++ PPT
FUNCTIONS IN c++ PPT03062679929
 
Functions in c language
Functions in c language Functions in c language
Functions in c language tanmaymodi4
 
Loops in C Programming Language
Loops in C Programming LanguageLoops in C Programming Language
Loops in C Programming LanguageMahantesh Devoor
 
Inline function
Inline functionInline function
Inline functionTech_MX
 
Class and object in C++
Class and object in C++Class and object in C++
Class and object in C++rprajat007
 
Inheritance in c++
Inheritance in c++Inheritance in c++
Inheritance in c++Vineeta Garg
 
Object Oriented Programming Using C++
Object Oriented Programming Using C++Object Oriented Programming Using C++
Object Oriented Programming Using C++Muhammad Waqas
 
Function overloading(c++)
Function overloading(c++)Function overloading(c++)
Function overloading(c++)Ritika Sharma
 
Variables in C Programming
Variables in C ProgrammingVariables in C Programming
Variables in C Programmingprogramming9
 
structure and union
structure and unionstructure and union
structure and unionstudent
 
Union in c language
Union  in c languageUnion  in c language
Union in c languagetanmaymodi4
 

Was ist angesagt? (20)

Operator Overloading
Operator OverloadingOperator Overloading
Operator Overloading
 
Structure in C
Structure in CStructure in C
Structure in C
 
Applets in java
Applets in javaApplets in java
Applets in java
 
Constructors and destructors
Constructors and destructorsConstructors and destructors
Constructors and destructors
 
INTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMINGINTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMING
 
Data types in C
Data types in CData types in C
Data types in C
 
FUNCTIONS IN c++ PPT
FUNCTIONS IN c++ PPTFUNCTIONS IN c++ PPT
FUNCTIONS IN c++ PPT
 
C functions
C functionsC functions
C functions
 
Pointers in C Programming
Pointers in C ProgrammingPointers in C Programming
Pointers in C Programming
 
Functions in c language
Functions in c language Functions in c language
Functions in c language
 
Loops in C Programming Language
Loops in C Programming LanguageLoops in C Programming Language
Loops in C Programming Language
 
Inline function
Inline functionInline function
Inline function
 
Class and object in C++
Class and object in C++Class and object in C++
Class and object in C++
 
Inheritance in c++
Inheritance in c++Inheritance in c++
Inheritance in c++
 
Control statements in c
Control statements in cControl statements in c
Control statements in c
 
Object Oriented Programming Using C++
Object Oriented Programming Using C++Object Oriented Programming Using C++
Object Oriented Programming Using C++
 
Function overloading(c++)
Function overloading(c++)Function overloading(c++)
Function overloading(c++)
 
Variables in C Programming
Variables in C ProgrammingVariables in C Programming
Variables in C Programming
 
structure and union
structure and unionstructure and union
structure and union
 
Union in c language
Union  in c languageUnion  in c language
Union in c language
 

Andere mochten auch (20)

Storage classes in C
Storage classes in CStorage classes in C
Storage classes in C
 
11 lec 11 storage class
11 lec 11 storage class11 lec 11 storage class
11 lec 11 storage class
 
Storage Classes and Functions
Storage Classes and FunctionsStorage Classes and Functions
Storage Classes and Functions
 
Storage class in c
Storage class in cStorage class in c
Storage class in c
 
Storage Class in C Progrmming
Storage Class in C Progrmming Storage Class in C Progrmming
Storage Class in C Progrmming
 
Storage class
Storage classStorage class
Storage class
 
Variables, Data Types, Operator & Expression in c in detail
Variables, Data Types, Operator & Expression in c in detailVariables, Data Types, Operator & Expression in c in detail
Variables, Data Types, Operator & Expression in c in detail
 
Memory
MemoryMemory
Memory
 
Jdbc
JdbcJdbc
Jdbc
 
Enumerated data types in C
Enumerated data types in CEnumerated data types in C
Enumerated data types in C
 
Arrays
ArraysArrays
Arrays
 
Overview of c language
Overview of c languageOverview of c language
Overview of c language
 
Array in c language
Array in c languageArray in c language
Array in c language
 
Control statements
Control statementsControl statements
Control statements
 
Solid waste management ppt
Solid waste management pptSolid waste management ppt
Solid waste management ppt
 
Storage class
Storage classStorage class
Storage class
 
Scope of variables
Scope of variablesScope of variables
Scope of variables
 
Storage classes
Storage classesStorage classes
Storage classes
 
Constants in C Programming
Constants in C ProgrammingConstants in C Programming
Constants in C Programming
 
Scope of variables
Scope of variablesScope of variables
Scope of variables
 

Ähnlich wie Storage class in C Language

from java to c
from java to cfrom java to c
from java to cVõ Hòa
 
What is storage class
What is storage classWhat is storage class
What is storage classIsha Aggarwal
 
C Storage Classes VSN
C Storage Classes VSNC Storage Classes VSN
C Storage Classes VSNNITTTR
 
Storage classes in C
Storage classes in C Storage classes in C
Storage classes in C Self employed
 
C Programming Storage classes, Recursion
C Programming Storage classes, RecursionC Programming Storage classes, Recursion
C Programming Storage classes, RecursionSreedhar Chowdam
 
Getting Started Cpp
Getting Started CppGetting Started Cpp
Getting Started CppLong Cao
 
Storage_classes_and_Scope_rules.pptx
Storage_classes_and_Scope_rules.pptxStorage_classes_and_Scope_rules.pptx
Storage_classes_and_Scope_rules.pptxCheriviralaNikhil
 
Data structure week 1
Data structure week 1Data structure week 1
Data structure week 1karmuhtam
 
ECSE 221 - Introduction to Computer Engineering - Tutorial 1 - Muhammad Ehtas...
ECSE 221 - Introduction to Computer Engineering - Tutorial 1 - Muhammad Ehtas...ECSE 221 - Introduction to Computer Engineering - Tutorial 1 - Muhammad Ehtas...
ECSE 221 - Introduction to Computer Engineering - Tutorial 1 - Muhammad Ehtas...Muhammad Ulhaque
 
storage class
storage classstorage class
storage classstudent
 

Ähnlich wie Storage class in C Language (20)

Storage class
Storage classStorage class
Storage class
 
Storage classes
Storage classesStorage classes
Storage classes
 
Storage class
Storage classStorage class
Storage class
 
Storage class
Storage classStorage class
Storage class
 
from java to c
from java to cfrom java to c
from java to c
 
What is storage class
What is storage classWhat is storage class
What is storage class
 
Storage classes
Storage classesStorage classes
Storage classes
 
C Storage Classes VSN
C Storage Classes VSNC Storage Classes VSN
C Storage Classes VSN
 
Lecture 13 - Storage Classes
Lecture 13 - Storage ClassesLecture 13 - Storage Classes
Lecture 13 - Storage Classes
 
Storage classes in C
Storage classes in C Storage classes in C
Storage classes in C
 
C Programming Storage classes, Recursion
C Programming Storage classes, RecursionC Programming Storage classes, Recursion
C Programming Storage classes, Recursion
 
Getting Started Cpp
Getting Started CppGetting Started Cpp
Getting Started Cpp
 
Storage_classes_and_Scope_rules.pptx
Storage_classes_and_Scope_rules.pptxStorage_classes_and_Scope_rules.pptx
Storage_classes_and_Scope_rules.pptx
 
Data structure week 1
Data structure week 1Data structure week 1
Data structure week 1
 
Storage classes
Storage classesStorage classes
Storage classes
 
visiblity and scope.pptx
visiblity and scope.pptxvisiblity and scope.pptx
visiblity and scope.pptx
 
ECSE 221 - Introduction to Computer Engineering - Tutorial 1 - Muhammad Ehtas...
ECSE 221 - Introduction to Computer Engineering - Tutorial 1 - Muhammad Ehtas...ECSE 221 - Introduction to Computer Engineering - Tutorial 1 - Muhammad Ehtas...
ECSE 221 - Introduction to Computer Engineering - Tutorial 1 - Muhammad Ehtas...
 
storage class
storage classstorage class
storage class
 
Unit iii
Unit iiiUnit iii
Unit iii
 
C++ theory
C++ theoryC++ theory
C++ theory
 

Kürzlich hochgeladen

Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxChelloAnnAsuncion2
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomnelietumpap1
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxDr.Ibrahim Hassaan
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYKayeClaireEstoconing
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxCarlos105
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 

Kürzlich hochgeladen (20)

Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptx
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 

Storage class in C Language

  • 2. STORAGE CLASS  The storage class determines the part of the memory where the variable would be stored.  The storage class also determines the initial value of the variable.  and it used to define the scope and lifetime of variable.  There are two storage location in computer : CPU Registers and Memory
  • 3. CPU REGISTER AND MEMORY  A value stored in a CPU register can always be accessed faster then the one that is stored in memory.
  • 4. TYPES OF STORAGE CLASSES There are four types of storage classes in C: i. Automatic storage class ii. Register storage class iii. Static storage class iv. External storage class
  • 5. Automatic Storage Class  Keywords : auto.  Storage : memory.  Default initial value : garbage value.  Scope : local to the block in which the variable is defined.  Life : till the control remains within the block in which the variable is defined.
  • 6. Example of Automatic Storage Class #include<stdio.h> #include<conio.h> void main() { auto int i=1; { auto int i=2; { auto int i=3; printf(“n%d”,i); } printf(“%d”,i); } printf(“%d”,i); getch(); } Output: 3 2 1
  • 7. Register Storage Class  Keywords : register.  Storage : CPU Register.  Default initial value : garbage value.  Scope : local to the block in which the variable is defined.  Life : till the control remains within the block in which the variable is defined.
  • 8. Example of Register Storage Class #include<stdio.h> #include<conio.h> void main() { register int i; for(i=1;i<=10;i++) printf(“ %d",i); getch(); } Output: 1 2 3 4 5 6 7 8 9 10
  • 9. Register Storage Class  If the microprocessor has 16-bit registers then they cannot hold a float value or a double value which requires 4bytes(32-bit) and 8 bytes(64-bit)  If you want to use the register storage class(16-bit microprocessor) with float and double variable then you won‟t get any error messages. Your compiler would treat the variables as auto storage class.
  • 10. Static Storage Class  Keywords : static.  Storage : memory.  Default initial value : zero.  Scope : local to the block in which the variable is defined.  Life : value of the variable persists between different function calls.
  • 11. Dif. b/w auto and static storage class Automatic Static #include<stdio.h> #include<stdio.h> #include<conio.h> #include<conio.h> increment(); increment(); void main() void main() { { increment(); increment(); increment(); increment(); increment(); increment(); } } increment() increment() { { auto int i=1; static int i=1; printf("%dt",i); printf("%dt",i); i++; i++; getch(); getch(); } } Output: Output: 1 1 1 1 2 3
  • 12. External Storage Class  Keywords : extern.  Storage : memory.  Default initial value : zero.  Scope : global.  Life : as long as the program‟s execution doesn‟t come to an end.
  • 13. • The different b/w two programs 1st auto and 2nd static storage class for variable „i‟ the scope of auto and static both use local to the block in witch the variable is declared. • Those program consists two functions main() and increment(). • The increment() function called from main() function for three times. • Each time increment the value of „i‟ and print. • when variable „i‟ is auto each time increment and re-initialized to 1.
  • 14. Example of External Storage Class #include<stdio.h> #include<conio.h> int i =1; increment(); void main() { printf("%dt",i); increment(); increment(); getch(); } increment() { i++; printf("%dt",i); } Output: 1 2 3