SlideShare a Scribd company logo
PAPER: INTRODUCTION PROGRAMMING LANGUAGE USING C
PAPER ID: 20105
PAPER CODE: BCA 105
DR. VARUN TIWARI
(ASSOCIATE PROFESSOR)
(DEPARTMENT OF COMPUTER SCIENCE)
BOSCO TECHNICAL TRAINING SOCIETY,
DON BOSCO TECHNICAL SCHOOL, OKHLA ROAD , NEW DELHI
C STORAGE CLASS
OBJECTIVES
IN THIS UNIT YOU WILL LEARN:
1. TO UNDERSTAND ABOUT STORAGE CLASS IN C.
2. TO LEARN ABOUT WHY WE USE STORAGE CLASS.
3. TO LEARN ABOUT AUTOMATIC STORAGE CLASS.
4. TO LEARN ABOUT REGULAR STORAGE CLASS.
5. TO LEARN ABOUT STATIC STORAGE CLASS IN C.
6. TO LEARN ABOUT EXTERNAL STORAGE CLASS IN C.
STORAGE CLASS: WE CAN CHARACTERIZE VARIABLE IN TWO DIFFERENT WAYS:
1. DATA TYPE
2. STORAGE CLASS
STORAGE CLASS REFER TO THE PERFORMANCE OF VARIABLE AND ITS SCOPE WITH IN THE PROGRAM. THE
SCOPE WITH USE THE PROGRAM MEANS THE POSITION OF THE PROGRAM OVER WHICH THE VARIABLE IS
RECOGNIZED. A VARIABLE STORAGE CLASSES TELLS US:
1. WHERE THE VARIABLE WOULD BE STORED.
2. WHAT WOULD BE THE DEFAULT INITIAL VALUE OF THE VARIABLE.
3. WHAT IS THE SCOPE OF THE VARIABLE; I.E IN WHICH FUNCTIONS THE VALUE OF THE VARIABLE WOULD
BE AVAILABLE.
4. WHAT IS THE LIST OF THE VARIABLE; IE HOW LONG WOULD THE VARIABLE EXIST.
THERE ARE FOUR STORAGE CLASS IN C:
1. AUTOMATIC STORAGE CLASS
2. EXTERNAL STORAGE CLASS
3. STATIC STORAGE CLASS
4. REGISTER STORAGE CLASS
1. AUTOMATIC STORAGE CLASS: (VARIABLE LOCAL): WHEN WE PASS ARGUMENTS TO A FUNCTION WE ARE
ACTUALLY FUNCTION COPY OF THE VALUE WITH IN THE VARIABLE. SUCH VALUE MUST BE PLACED IN THE
VARIABLE WITH IN THE CALLED FUNCTION. EACH TIME THE FUNCTION IS CALLED VARIABLE ARE CREATED BY THE
SYSTEM TO STORE THESE VALUE. THE VARIABLE ARE TERM AUTOMATIC BECAUSE THEY ARE CREATED
AUTOMATICALLY WITH EACH CALLED TO THE FUNCTION SO AUTOMATIC VARIABLE ARE ALWAYS VARIABLE
DECLARED WITH IN THE FUNCTION ARE LOCAL TO THE FUNCTION IN WHICH THEY ARE DECLARED AND THESE
VARIABLE ARE DESTROY AUTOMATICALLY, WHENEVER CONTROL RETURN BACK TO THE MAIN FUNCTION. THE
SPECIFICATION OF THE KEYWORD AUTO AT THE BEGINNING OF EACH LOCAL VARIABLE DECALARATION AUTO IS
OPTIONAL KEYWORD. THE FEATURES OF AN AUTOMATIC STORAGE CLASS VARIABLE ARE AS UNDER:
STORAGE: MEMORY
DEFAULT VALUE: AN UNPREDICTABLE VALUE, OFTEN CALLED A 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.
EX-:
void main()
{
auto int p,q;
clrscr();
printf("enter two number-:");
scanf("%d%d",&p,&q);
printf("output is -%d%d",p,q);
getch();
}
2. EXTERNAL STORAGE CLASS: (VARIABLE GLOBAL): EXTERNAL VARIABLE ARE NOT BOUND TO A SINGLE
FUNCTION. EXTERNAL VARIABLE REMAIN COMMON FOR ALL THE FUNCTION WITH IN THE SAME PROGRAM.
THESE EXTERNAL VARIABLE ARE ALSO CALLED GLOBAL VARIABLE. THE EXTERNAL VARIABLE CAN BE ASSIGN
A VALUE WITH IN ONE FUNCTION AND THAT VALUE CAN BE USED WITH IN ANOTHER FUNCTION SO THE
SCOPE OF EXTERNAL VARIABLE EXTEND FROM THE POINT OF DEFINITION THROUGH THE REMAINDER OF
THE PROGRAM. WE HAVE TO USE EXTERN KEYWORD OF THE DECLARATION OF GLOBAL VARIABLE. IT IS AN
OPTIONAL KEYWORD.
THE FEATURES OF AN EXTERNAL STORAGE CLASS VARIABLE ARE AS FOLLOWS:
STORAGE: MEMORY
DEFAULT VALUE: NOT ZERO
SCOPE: GLOBAL
LIFE: AS LONG AS THE PROGRAM’S EXECUTION DOES NOT COME TO AN END.
3. STATIC STORAGE CLASS: C PROVIDE FOR ANOTHER CLASS OF VARIABLE ALL STATIC VARIABLE. THE
STORAGE CLASS FOR HAVE EITHER AN EXTERNAL OR INTERNAL FORM. THE EITHER CASE VARIABLE OF THIS
CLASS MUST BE DECLARED USING THE KEYWORD STATIC. THE SCOPE OF STATIC VARIABLE DIFFER
DEPENDING ON WHETHER KEY ARE EXTERNAL AND INTERNAL. IN STATIC STORAGE CLASS ONLY , IF YOU
WANT THE VALUE OF A VARIABLE TO PERSIST BETWEEN DIFFERENT FUNCTION CALLS. A TYPICAL
APPLICATION OF THIS STORAGE CLASS IS RECURSIVE FUNCTION.
THE FEATURES OF AN STATIC STORAGE CLASS VARIABLE ARE AS FOLLOWS:
STORAGE: MEMORY
DEFAULT VALUE: ZERO
SCOPE: LOCAL TO THE BLOCK IN WHICH THE VARIABLE IS DEFINED.
LIFE: VALUE OF THE VARIABLE PERSISTS BETWEEN DIFFERENT FUNCTION CALLS.
4. REGISTER STORAGE CLASS: USE REGISTER STORAGE CLASS FOR ONLY THOSE VARIABLE WHICH ARE
BEING USED VERY OFTEN IN A PROGRAM REASON IS, THERE ARE VERY FEW CPU REGISTER AT OUR
DISPOSAL AND MANY OF THEM MIGHT BE BUSY DOING SOMETHING ELSE. A VALUE STORED IN A CPU
REGISTER CAN ALWAYS BE ACCESSED FASTER THAN THE ONE WHICH IS IN THE STORING MEMORY.
THEREFORE IF A VARIABLE IS USED AT MANY PLACES IN A PROGRAM. IT IS BETTER TO DECLARED IT
STORAGE CLASS AS REGISTER. A FLOAT VALUE REQUIRES 4 BYTES , SO IT CAN NOT BE STORED IN A CPU
REGISTER. IF THE MICROPROCESSOR HAS 16-BIT CPU REGISTERS. IF YOU USE REGISTER STORAGE CLASS
FOR A FLOAT IN SUCH A CASE, YOU WOULD NOT GET ANY ERROR MESSAGE INSTEAD, THE COMPILER
WOULD TREAT IT AS AN AUTO STORAGE CLASS VARIABLE.
THE FEATURES OF AN REGISTER STORAGE CLASS VARIABLE ARE AS FOLLOWS:
STORAGE: CPU REGISTER
DEFAULT 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.
THANK YOU

More Related Content

Similar to C storage class

Storage class
Storage classStorage class
Storage class
Kalaikumar Thangapandi
 
Storage class
Storage classStorage class
Storage class
Joy Forerver
 
Arrays 2 Dimensional Unit 2 Part 1.pdf
Arrays 2 Dimensional Unit 2 Part 1.pdfArrays 2 Dimensional Unit 2 Part 1.pdf
Arrays 2 Dimensional Unit 2 Part 1.pdf
Arpana Awasthi
 
Storage Class Specifiers in C++
Storage Class Specifiers in C++Storage Class Specifiers in C++
Storage Class Specifiers in C++
Reddhi Basu
 
Storage classes in c language
Storage classes in c languageStorage classes in c language
Storage classes in c language
Tanmay Modi
 
Storage classes in c language
Storage classes in c languageStorage classes in c language
Storage classes in c language
tanmaymodi4
 
Function in C Programming
Function in C ProgrammingFunction in C Programming
Storage_classes_and_Scope_rules.pptx
Storage_classes_and_Scope_rules.pptxStorage_classes_and_Scope_rules.pptx
Storage_classes_and_Scope_rules.pptx
CheriviralaNikhil
 
STORAGE CLASSES
STORAGE CLASSESSTORAGE CLASSES
STORAGE CLASSES
sathish sak
 
Storage Class Specifiers
Storage Class SpecifiersStorage Class Specifiers
Storage Class Specifiers
Reddhi Basu
 
Storage Class in C Progrmming
Storage Class in C Progrmming Storage Class in C Progrmming
Storage Class in C Progrmming
Kamal Acharya
 
Static variables
Static variablesStatic variables
Terms and Definitions.pdf
Terms and Definitions.pdfTerms and Definitions.pdf
Terms and Definitions.pdf
SheikhAbrarAhmad
 
Storage classes
Storage classesStorage classes
Storage classes
Praveen M Jigajinni
 
5.program structure
5.program structure5.program structure
5.program structure
Shankar Gangaju
 
Library management system
Library management systemLibrary management system
Library management system
SHARDA SHARAN
 
VB PPT by ADI PART2.pdf
VB PPT by ADI PART2.pdfVB PPT by ADI PART2.pdf
VB PPT by ADI PART2.pdf
AdiseshaK
 
Relational Database Management System
Relational Database Management SystemRelational Database Management System
Relational Database Management System
sweetysweety8
 
Types of storage class specifiers in c programming
Types of storage class specifiers in c programmingTypes of storage class specifiers in c programming
Types of storage class specifiers in c programming
Appili Vamsi Krishna
 
Meg bernal insight2014 4219
Meg bernal insight2014 4219Meg bernal insight2014 4219
Meg bernal insight2014 4219
Peter Schouboe
 

Similar to C storage class (20)

Storage class
Storage classStorage class
Storage class
 
Storage class
Storage classStorage class
Storage class
 
Arrays 2 Dimensional Unit 2 Part 1.pdf
Arrays 2 Dimensional Unit 2 Part 1.pdfArrays 2 Dimensional Unit 2 Part 1.pdf
Arrays 2 Dimensional Unit 2 Part 1.pdf
 
Storage Class Specifiers in C++
Storage Class Specifiers in C++Storage Class Specifiers in C++
Storage Class Specifiers in C++
 
Storage classes in c language
Storage classes in c languageStorage classes in c language
Storage classes in c language
 
Storage classes in c language
Storage classes in c languageStorage classes in c language
Storage classes in c language
 
Function in C Programming
Function in C ProgrammingFunction in C Programming
Function in C Programming
 
Storage_classes_and_Scope_rules.pptx
Storage_classes_and_Scope_rules.pptxStorage_classes_and_Scope_rules.pptx
Storage_classes_and_Scope_rules.pptx
 
STORAGE CLASSES
STORAGE CLASSESSTORAGE CLASSES
STORAGE CLASSES
 
Storage Class Specifiers
Storage Class SpecifiersStorage Class Specifiers
Storage Class Specifiers
 
Storage Class in C Progrmming
Storage Class in C Progrmming Storage Class in C Progrmming
Storage Class in C Progrmming
 
Static variables
Static variablesStatic variables
Static variables
 
Terms and Definitions.pdf
Terms and Definitions.pdfTerms and Definitions.pdf
Terms and Definitions.pdf
 
Storage classes
Storage classesStorage classes
Storage classes
 
5.program structure
5.program structure5.program structure
5.program structure
 
Library management system
Library management systemLibrary management system
Library management system
 
VB PPT by ADI PART2.pdf
VB PPT by ADI PART2.pdfVB PPT by ADI PART2.pdf
VB PPT by ADI PART2.pdf
 
Relational Database Management System
Relational Database Management SystemRelational Database Management System
Relational Database Management System
 
Types of storage class specifiers in c programming
Types of storage class specifiers in c programmingTypes of storage class specifiers in c programming
Types of storage class specifiers in c programming
 
Meg bernal insight2014 4219
Meg bernal insight2014 4219Meg bernal insight2014 4219
Meg bernal insight2014 4219
 

More from Bosco Technical Training Society, Don Bosco Technical School (Aff. GGSIP University, New Delhi)

String Manipulation Function and Header File Functions
String Manipulation Function and Header File FunctionsString Manipulation Function and Header File Functions
C Structure and Union in C
C Structure and Union in CC Structure and Union in C
Preprocessor Directive in C
Preprocessor Directive in CPreprocessor Directive in C
File Handling in C Programming
File Handling in C ProgrammingFile Handling in C Programming
Bit field enum and command line arguments
Bit field enum and command line argumentsBit field enum and command line arguments
Pointers in C and Dynamic Memory Allocation
Pointers in C and Dynamic Memory AllocationPointers in C and Dynamic Memory Allocation
Array in C
Array in CArray in C
C Constructs (C Statements & Loop)
C Constructs (C Statements & Loop)C Constructs (C Statements & Loop)
C Operators
C OperatorsC Operators
C programming Basics
C programming BasicsC programming Basics
Software Development Skills and SDLC
Software Development Skills and SDLCSoftware Development Skills and SDLC
Mobile commerce
Mobile commerceMobile commerce
E commerce application
E commerce applicationE commerce application
Data normalization
Data normalizationData normalization
Html Form Controls
Html Form ControlsHtml Form Controls
Security issue in e commerce
Security issue in e commerceSecurity issue in e commerce
ER to Relational Mapping
ER to Relational MappingER to Relational Mapping
Entity Relationship Model
Entity Relationship ModelEntity Relationship Model
Database connectivity with data reader by varun tiwari
Database connectivity with data reader by varun tiwariDatabase connectivity with data reader by varun tiwari
Ado vs ado.net by varun tiwari
Ado vs ado.net by varun tiwariAdo vs ado.net by varun tiwari

More from Bosco Technical Training Society, Don Bosco Technical School (Aff. GGSIP University, New Delhi) (20)

String Manipulation Function and Header File Functions
String Manipulation Function and Header File FunctionsString Manipulation Function and Header File Functions
String Manipulation Function and Header File Functions
 
C Structure and Union in C
C Structure and Union in CC Structure and Union in C
C Structure and Union in C
 
Preprocessor Directive in C
Preprocessor Directive in CPreprocessor Directive in C
Preprocessor Directive in C
 
File Handling in C Programming
File Handling in C ProgrammingFile Handling in C Programming
File Handling in C Programming
 
Bit field enum and command line arguments
Bit field enum and command line argumentsBit field enum and command line arguments
Bit field enum and command line arguments
 
Pointers in C and Dynamic Memory Allocation
Pointers in C and Dynamic Memory AllocationPointers in C and Dynamic Memory Allocation
Pointers in C and Dynamic Memory Allocation
 
Array in C
Array in CArray in C
Array in C
 
C Constructs (C Statements & Loop)
C Constructs (C Statements & Loop)C Constructs (C Statements & Loop)
C Constructs (C Statements & Loop)
 
C Operators
C OperatorsC Operators
C Operators
 
C programming Basics
C programming BasicsC programming Basics
C programming Basics
 
Software Development Skills and SDLC
Software Development Skills and SDLCSoftware Development Skills and SDLC
Software Development Skills and SDLC
 
Mobile commerce
Mobile commerceMobile commerce
Mobile commerce
 
E commerce application
E commerce applicationE commerce application
E commerce application
 
Data normalization
Data normalizationData normalization
Data normalization
 
Html Form Controls
Html Form ControlsHtml Form Controls
Html Form Controls
 
Security issue in e commerce
Security issue in e commerceSecurity issue in e commerce
Security issue in e commerce
 
ER to Relational Mapping
ER to Relational MappingER to Relational Mapping
ER to Relational Mapping
 
Entity Relationship Model
Entity Relationship ModelEntity Relationship Model
Entity Relationship Model
 
Database connectivity with data reader by varun tiwari
Database connectivity with data reader by varun tiwariDatabase connectivity with data reader by varun tiwari
Database connectivity with data reader by varun tiwari
 
Ado vs ado.net by varun tiwari
Ado vs ado.net by varun tiwariAdo vs ado.net by varun tiwari
Ado vs ado.net by varun tiwari
 

Recently uploaded

ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
eBook.com.bd (প্রয়োজনীয় বাংলা বই)
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Excellence Foundation for South Sudan
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
WaniBasim
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
Dr. Shivangi Singh Parihar
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
Academy of Science of South Africa
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
Celine George
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
Celine George
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
chanes7
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
adhitya5119
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
GeorgeMilliken2
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
Priyankaranawat4
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
National Information Standards Organization (NISO)
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
Celine George
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
Israel Genealogy Research Association
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
Celine George
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
adhitya5119
 

Recently uploaded (20)

ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
 

C storage class

  • 1. PAPER: INTRODUCTION PROGRAMMING LANGUAGE USING C PAPER ID: 20105 PAPER CODE: BCA 105 DR. VARUN TIWARI (ASSOCIATE PROFESSOR) (DEPARTMENT OF COMPUTER SCIENCE) BOSCO TECHNICAL TRAINING SOCIETY, DON BOSCO TECHNICAL SCHOOL, OKHLA ROAD , NEW DELHI
  • 3. OBJECTIVES IN THIS UNIT YOU WILL LEARN: 1. TO UNDERSTAND ABOUT STORAGE CLASS IN C. 2. TO LEARN ABOUT WHY WE USE STORAGE CLASS. 3. TO LEARN ABOUT AUTOMATIC STORAGE CLASS. 4. TO LEARN ABOUT REGULAR STORAGE CLASS. 5. TO LEARN ABOUT STATIC STORAGE CLASS IN C. 6. TO LEARN ABOUT EXTERNAL STORAGE CLASS IN C.
  • 4. STORAGE CLASS: WE CAN CHARACTERIZE VARIABLE IN TWO DIFFERENT WAYS: 1. DATA TYPE 2. STORAGE CLASS STORAGE CLASS REFER TO THE PERFORMANCE OF VARIABLE AND ITS SCOPE WITH IN THE PROGRAM. THE SCOPE WITH USE THE PROGRAM MEANS THE POSITION OF THE PROGRAM OVER WHICH THE VARIABLE IS RECOGNIZED. A VARIABLE STORAGE CLASSES TELLS US: 1. WHERE THE VARIABLE WOULD BE STORED. 2. WHAT WOULD BE THE DEFAULT INITIAL VALUE OF THE VARIABLE. 3. WHAT IS THE SCOPE OF THE VARIABLE; I.E IN WHICH FUNCTIONS THE VALUE OF THE VARIABLE WOULD BE AVAILABLE. 4. WHAT IS THE LIST OF THE VARIABLE; IE HOW LONG WOULD THE VARIABLE EXIST.
  • 5. THERE ARE FOUR STORAGE CLASS IN C: 1. AUTOMATIC STORAGE CLASS 2. EXTERNAL STORAGE CLASS 3. STATIC STORAGE CLASS 4. REGISTER STORAGE CLASS 1. AUTOMATIC STORAGE CLASS: (VARIABLE LOCAL): WHEN WE PASS ARGUMENTS TO A FUNCTION WE ARE ACTUALLY FUNCTION COPY OF THE VALUE WITH IN THE VARIABLE. SUCH VALUE MUST BE PLACED IN THE VARIABLE WITH IN THE CALLED FUNCTION. EACH TIME THE FUNCTION IS CALLED VARIABLE ARE CREATED BY THE SYSTEM TO STORE THESE VALUE. THE VARIABLE ARE TERM AUTOMATIC BECAUSE THEY ARE CREATED AUTOMATICALLY WITH EACH CALLED TO THE FUNCTION SO AUTOMATIC VARIABLE ARE ALWAYS VARIABLE DECLARED WITH IN THE FUNCTION ARE LOCAL TO THE FUNCTION IN WHICH THEY ARE DECLARED AND THESE VARIABLE ARE DESTROY AUTOMATICALLY, WHENEVER CONTROL RETURN BACK TO THE MAIN FUNCTION. THE SPECIFICATION OF THE KEYWORD AUTO AT THE BEGINNING OF EACH LOCAL VARIABLE DECALARATION AUTO IS OPTIONAL KEYWORD. THE FEATURES OF AN AUTOMATIC STORAGE CLASS VARIABLE ARE AS UNDER:
  • 6. STORAGE: MEMORY DEFAULT VALUE: AN UNPREDICTABLE VALUE, OFTEN CALLED A 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. EX-: void main() { auto int p,q; clrscr(); printf("enter two number-:"); scanf("%d%d",&p,&q); printf("output is -%d%d",p,q); getch(); }
  • 7.
  • 8. 2. EXTERNAL STORAGE CLASS: (VARIABLE GLOBAL): EXTERNAL VARIABLE ARE NOT BOUND TO A SINGLE FUNCTION. EXTERNAL VARIABLE REMAIN COMMON FOR ALL THE FUNCTION WITH IN THE SAME PROGRAM. THESE EXTERNAL VARIABLE ARE ALSO CALLED GLOBAL VARIABLE. THE EXTERNAL VARIABLE CAN BE ASSIGN A VALUE WITH IN ONE FUNCTION AND THAT VALUE CAN BE USED WITH IN ANOTHER FUNCTION SO THE SCOPE OF EXTERNAL VARIABLE EXTEND FROM THE POINT OF DEFINITION THROUGH THE REMAINDER OF THE PROGRAM. WE HAVE TO USE EXTERN KEYWORD OF THE DECLARATION OF GLOBAL VARIABLE. IT IS AN OPTIONAL KEYWORD. THE FEATURES OF AN EXTERNAL STORAGE CLASS VARIABLE ARE AS FOLLOWS: STORAGE: MEMORY DEFAULT VALUE: NOT ZERO SCOPE: GLOBAL LIFE: AS LONG AS THE PROGRAM’S EXECUTION DOES NOT COME TO AN END.
  • 9.
  • 10. 3. STATIC STORAGE CLASS: C PROVIDE FOR ANOTHER CLASS OF VARIABLE ALL STATIC VARIABLE. THE STORAGE CLASS FOR HAVE EITHER AN EXTERNAL OR INTERNAL FORM. THE EITHER CASE VARIABLE OF THIS CLASS MUST BE DECLARED USING THE KEYWORD STATIC. THE SCOPE OF STATIC VARIABLE DIFFER DEPENDING ON WHETHER KEY ARE EXTERNAL AND INTERNAL. IN STATIC STORAGE CLASS ONLY , IF YOU WANT THE VALUE OF A VARIABLE TO PERSIST BETWEEN DIFFERENT FUNCTION CALLS. A TYPICAL APPLICATION OF THIS STORAGE CLASS IS RECURSIVE FUNCTION. THE FEATURES OF AN STATIC STORAGE CLASS VARIABLE ARE AS FOLLOWS: STORAGE: MEMORY DEFAULT VALUE: ZERO SCOPE: LOCAL TO THE BLOCK IN WHICH THE VARIABLE IS DEFINED. LIFE: VALUE OF THE VARIABLE PERSISTS BETWEEN DIFFERENT FUNCTION CALLS.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15. 4. REGISTER STORAGE CLASS: USE REGISTER STORAGE CLASS FOR ONLY THOSE VARIABLE WHICH ARE BEING USED VERY OFTEN IN A PROGRAM REASON IS, THERE ARE VERY FEW CPU REGISTER AT OUR DISPOSAL AND MANY OF THEM MIGHT BE BUSY DOING SOMETHING ELSE. A VALUE STORED IN A CPU REGISTER CAN ALWAYS BE ACCESSED FASTER THAN THE ONE WHICH IS IN THE STORING MEMORY. THEREFORE IF A VARIABLE IS USED AT MANY PLACES IN A PROGRAM. IT IS BETTER TO DECLARED IT STORAGE CLASS AS REGISTER. A FLOAT VALUE REQUIRES 4 BYTES , SO IT CAN NOT BE STORED IN A CPU REGISTER. IF THE MICROPROCESSOR HAS 16-BIT CPU REGISTERS. IF YOU USE REGISTER STORAGE CLASS FOR A FLOAT IN SUCH A CASE, YOU WOULD NOT GET ANY ERROR MESSAGE INSTEAD, THE COMPILER WOULD TREAT IT AS AN AUTO STORAGE CLASS VARIABLE. THE FEATURES OF AN REGISTER STORAGE CLASS VARIABLE ARE AS FOLLOWS: STORAGE: CPU REGISTER DEFAULT 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.
  • 16.
  • 17.
  • 18.