SlideShare a Scribd company logo
STATIC VARIABLES
WHAT IS STATIC
• Static is a keyword in C++
• Can be used with the following:
• Variable declaration
• Class data member declaration
• Allocated storage on static storage area.
• Local variable gets storage on stack, whereas global
variables, arrays, pointers gets storage on heap.
DECLARING STATIC VARIABLE
• A variable is declared as static by writing the keyword
static in front of variable declaration.
• For example:
• static int a; //declaring static variable
int main()
{
int a;
}
int main()
{
static int a;
}
LOCAL /
AUTOMATIC
VARIABLE
STATIC
VARIABLE
SOME IMPORTANT POINTS ABOUT STATIC
VARIABLE:
• The default value of a static variable is always 0.
• The scope or lifetime of a static variable is not only within
the function but is within the whole program.
• Static variable is initialized only once i.e. it cannot be
reinitialized again and again when a function will be called
many times.
Static variables

More Related Content

What's hot

C functions
C functionsC functions
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in javaTech_MX
 
Java interfaces
Java interfacesJava interfaces
Java interfaces
Raja Sekhar
 
Access specifiers(modifiers) in java
Access specifiers(modifiers) in javaAccess specifiers(modifiers) in java
Access specifiers(modifiers) in java
HrithikShinde
 
Conditional Statement in C Language
Conditional Statement in C LanguageConditional Statement in C Language
Conditional Statement in C Language
Shaina Arora
 
Exception handling
Exception handlingException handling
Exception handling
Pranali Chaudhari
 
Functions in C
Functions in CFunctions in C
Functions in C
Kamal Acharya
 
Constructor ppt
Constructor pptConstructor ppt
Constructor ppt
Vinod Kumar
 
Data Types, Variables, and Operators
Data Types, Variables, and OperatorsData Types, Variables, and Operators
Data Types, Variables, and Operators
Marwa Ali Eissa
 
Classes, objects in JAVA
Classes, objects in JAVAClasses, objects in JAVA
Classes, objects in JAVAAbhilash Nair
 
Data types in C
Data types in CData types in C
Data types in C
Tarun Sharma
 
C++ OOPS Concept
C++ OOPS ConceptC++ OOPS Concept
C++ OOPS Concept
Boopathi K
 
Pointer in c
Pointer in cPointer in c
Pointer in c
lavanya marichamy
 
07. Virtual Functions
07. Virtual Functions07. Virtual Functions
07. Virtual Functions
Haresh Jaiswal
 
pseudo code basics
pseudo code basicspseudo code basics
pseudo code basics
Sabik T S
 
User defined functions in C programmig
User defined functions in C programmigUser defined functions in C programmig
User defined functions in C programmig
Appili Vamsi Krishna
 
Abstract class and Interface
Abstract class and InterfaceAbstract class and Interface
Abstract class and Interface
Haris Bin Zahid
 

What's hot (20)

Function in C program
Function in C programFunction in C program
Function in C program
 
C functions
C functionsC functions
C functions
 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in java
 
Java interfaces
Java interfacesJava interfaces
Java interfaces
 
Strings in Java
Strings in JavaStrings in Java
Strings in Java
 
Access specifiers(modifiers) in java
Access specifiers(modifiers) in javaAccess specifiers(modifiers) in java
Access specifiers(modifiers) in java
 
Functions in c++
Functions in c++Functions in c++
Functions in c++
 
Conditional Statement in C Language
Conditional Statement in C LanguageConditional Statement in C Language
Conditional Statement in C Language
 
Exception handling
Exception handlingException handling
Exception handling
 
Functions in C
Functions in CFunctions in C
Functions in C
 
Constructor ppt
Constructor pptConstructor ppt
Constructor ppt
 
Data Types, Variables, and Operators
Data Types, Variables, and OperatorsData Types, Variables, and Operators
Data Types, Variables, and Operators
 
Classes, objects in JAVA
Classes, objects in JAVAClasses, objects in JAVA
Classes, objects in JAVA
 
Data types in C
Data types in CData types in C
Data types in C
 
C++ OOPS Concept
C++ OOPS ConceptC++ OOPS Concept
C++ OOPS Concept
 
Pointer in c
Pointer in cPointer in c
Pointer in c
 
07. Virtual Functions
07. Virtual Functions07. Virtual Functions
07. Virtual Functions
 
pseudo code basics
pseudo code basicspseudo code basics
pseudo code basics
 
User defined functions in C programmig
User defined functions in C programmigUser defined functions in C programmig
User defined functions in C programmig
 
Abstract class and Interface
Abstract class and InterfaceAbstract class and Interface
Abstract class and Interface
 

Similar to Static variables

Global variables, sorting static variables,function and arrays,
Global variables, sorting static variables,function and arrays,Global variables, sorting static variables,function and arrays,
Global variables, sorting static variables,function and arrays,
Ahmad55ali
 
Storage classes
Storage classesStorage classes
Storage classes
priyanka jain
 
Storage classes
Storage classesStorage classes
Storage classes
UTTAM VERMA
 
Storage classes
Storage classesStorage classes
Storage classes
Leela Koneru
 
STORAGE CLASS.pptx
STORAGE CLASS.pptxSTORAGE CLASS.pptx
STORAGE CLASS.pptx
BU210535JeevanKishor
 
Static variable
Static variableStatic variable
Static variable
Himanshu Shekhar
 
Terms and Definitions.pdf
Terms and Definitions.pdfTerms and Definitions.pdf
Terms and Definitions.pdf
SheikhAbrarAhmad
 
Storage classes in C
Storage classes in C Storage classes in C
Storage classes in C
Self employed
 
STORAGE CLASSES
STORAGE CLASSESSTORAGE CLASSES
STORAGE CLASSES
sathish sak
 
Storage classes
Storage classesStorage classes
Storage classes
Praveen M Jigajinni
 
C language
C languageC language
C language
Arafat Bin Reza
 
Storage class
Storage classStorage class
Storage class
Kalaikumar Thangapandi
 
C MEMORY MODEL​.pptx
C MEMORY MODEL​.pptxC MEMORY MODEL​.pptx
C MEMORY MODEL​.pptx
SKUP1
 
C MEMORY MODEL​.pptx
C MEMORY MODEL​.pptxC MEMORY MODEL​.pptx
C MEMORY MODEL​.pptx
LECO9
 
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
 
Storage class
Storage classStorage class
Storage class
MANJULA_AP
 
5.program structure
5.program structure5.program structure
5.program structure
Shankar Gangaju
 

Similar to Static variables (20)

Global variables, sorting static variables,function and arrays,
Global variables, sorting static variables,function and arrays,Global variables, sorting static variables,function and arrays,
Global variables, sorting static variables,function and arrays,
 
Storage classes
Storage classesStorage classes
Storage classes
 
Storage classes
Storage classesStorage classes
Storage classes
 
Storage classes
Storage classesStorage classes
Storage classes
 
Storage classes
Storage classesStorage classes
Storage classes
 
STORAGE CLASS.pptx
STORAGE CLASS.pptxSTORAGE CLASS.pptx
STORAGE CLASS.pptx
 
Static variable
Static variableStatic variable
Static variable
 
Terms and Definitions.pdf
Terms and Definitions.pdfTerms and Definitions.pdf
Terms and Definitions.pdf
 
Storage classes in C
Storage classes in C Storage classes in C
Storage classes in C
 
STORAGE CLASSES
STORAGE CLASSESSTORAGE CLASSES
STORAGE CLASSES
 
Storage classes
Storage classesStorage classes
Storage classes
 
C language
C languageC language
C language
 
Storage class
Storage classStorage class
Storage class
 
C MEMORY MODEL​.pptx
C MEMORY MODEL​.pptxC MEMORY MODEL​.pptx
C MEMORY MODEL​.pptx
 
C MEMORY MODEL​.pptx
C MEMORY MODEL​.pptxC MEMORY MODEL​.pptx
C MEMORY MODEL​.pptx
 
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
 
Storage class
Storage classStorage class
Storage class
 
5.program structure
5.program structure5.program structure
5.program structure
 
Storage class
Storage classStorage class
Storage class
 

More from Jasleen Kaur (Chandigarh University)

Graphs data structures
Graphs data structuresGraphs data structures
Graphs data structures
Jasleen Kaur (Chandigarh University)
 
B+ trees and height balance tree
B+ trees and height balance treeB+ trees and height balance tree
B+ trees and height balance tree
Jasleen Kaur (Chandigarh University)
 
Basics of c++
Basics of c++Basics of c++
Operating system notes pdf
Operating system notes pdfOperating system notes pdf
Operating system notes pdf
Jasleen Kaur (Chandigarh University)
 
Priority Based Congestion Avoidance Hybrid Scheme published in IEEE
Priority Based Congestion Avoidance Hybrid Scheme published in IEEE Priority Based Congestion Avoidance Hybrid Scheme published in IEEE
Priority Based Congestion Avoidance Hybrid Scheme published in IEEE
Jasleen Kaur (Chandigarh University)
 
03 function overloading
03 function overloading03 function overloading
03 function overloading
Jasleen Kaur (Chandigarh University)
 
Chapter 2.datatypes and operators
Chapter 2.datatypes and operatorsChapter 2.datatypes and operators
Chapter 2.datatypes and operators
Jasleen Kaur (Chandigarh University)
 
Chapter 1
Chapter 1Chapter 1
Remote desktop connection
Remote desktop connectionRemote desktop connection
Remote desktop connection
Jasleen Kaur (Chandigarh University)
 
Operators in C Programming
Operators in C ProgrammingOperators in C Programming
Operators in C Programming
Jasleen Kaur (Chandigarh University)
 
Pointers in C Programming
Pointers in C ProgrammingPointers in C Programming
Pointers in C Programming
Jasleen Kaur (Chandigarh University)
 
Calculating garbage value in case of overflow
Calculating garbage value in case of overflowCalculating garbage value in case of overflow
Calculating garbage value in case of overflow
Jasleen Kaur (Chandigarh University)
 
Final jasleen ppt
Final jasleen pptFinal jasleen ppt
License Plate recognition
License Plate recognitionLicense Plate recognition
License Plate recognition
Jasleen Kaur (Chandigarh University)
 
The solar system
The solar system The solar system
The solar system
The solar systemThe solar system
Afforestation environmental issue
Afforestation environmental issueAfforestation environmental issue
Afforestation environmental issue
Jasleen Kaur (Chandigarh University)
 
Data aggregation in wireless sensor networks
Data aggregation in wireless sensor networksData aggregation in wireless sensor networks
Data aggregation in wireless sensor networks
Jasleen Kaur (Chandigarh University)
 

More from Jasleen Kaur (Chandigarh University) (19)

Graphs data structures
Graphs data structuresGraphs data structures
Graphs data structures
 
B+ trees and height balance tree
B+ trees and height balance treeB+ trees and height balance tree
B+ trees and height balance tree
 
Basics of c++
Basics of c++Basics of c++
Basics of c++
 
Operating system notes pdf
Operating system notes pdfOperating system notes pdf
Operating system notes pdf
 
Priority Based Congestion Avoidance Hybrid Scheme published in IEEE
Priority Based Congestion Avoidance Hybrid Scheme published in IEEE Priority Based Congestion Avoidance Hybrid Scheme published in IEEE
Priority Based Congestion Avoidance Hybrid Scheme published in IEEE
 
03 function overloading
03 function overloading03 function overloading
03 function overloading
 
Chapter 2.datatypes and operators
Chapter 2.datatypes and operatorsChapter 2.datatypes and operators
Chapter 2.datatypes and operators
 
Chapter 1
Chapter 1Chapter 1
Chapter 1
 
Remote desktop connection
Remote desktop connectionRemote desktop connection
Remote desktop connection
 
Operators in C Programming
Operators in C ProgrammingOperators in C Programming
Operators in C Programming
 
Pointers in C Programming
Pointers in C ProgrammingPointers in C Programming
Pointers in C Programming
 
Calculating garbage value in case of overflow
Calculating garbage value in case of overflowCalculating garbage value in case of overflow
Calculating garbage value in case of overflow
 
Final jasleen ppt
Final jasleen pptFinal jasleen ppt
Final jasleen ppt
 
License Plate recognition
License Plate recognitionLicense Plate recognition
License Plate recognition
 
The solar system
The solar system The solar system
The solar system
 
The solar system
The solar systemThe solar system
The solar system
 
Afforestation environmental issue
Afforestation environmental issueAfforestation environmental issue
Afforestation environmental issue
 
Data aggregation in wireless sensor networks
Data aggregation in wireless sensor networksData aggregation in wireless sensor networks
Data aggregation in wireless sensor networks
 
Network security
Network securityNetwork security
Network security
 

Recently uploaded

Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
The Role of Electrical and Electronics Engineers in IOT Technology.pdf
The Role of Electrical and Electronics Engineers in IOT Technology.pdfThe Role of Electrical and Electronics Engineers in IOT Technology.pdf
The Role of Electrical and Electronics Engineers in IOT Technology.pdf
Nettur Technical Training Foundation
 
Technical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prismsTechnical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prisms
heavyhaig
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
MdTanvirMahtab2
 
6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)
ClaraZara1
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Teleport Manpower Consultant
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
Aditya Rajan Patra
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
SUTEJAS
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
zwunae
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
Osamah Alsalih
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
SamSarthak3
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
gdsczhcet
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
thanhdowork
 
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdfTutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
aqil azizi
 
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming PipelinesHarnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Christina Lin
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
ydteq
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
Amil Baba Dawood bangali
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
Pratik Pawar
 
Forklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella PartsForklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella Parts
Intella Parts
 
DESIGN AND ANALYSIS OF A CAR SHOWROOM USING E TABS
DESIGN AND ANALYSIS OF A CAR SHOWROOM USING E TABSDESIGN AND ANALYSIS OF A CAR SHOWROOM USING E TABS
DESIGN AND ANALYSIS OF A CAR SHOWROOM USING E TABS
itech2017
 

Recently uploaded (20)

Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
The Role of Electrical and Electronics Engineers in IOT Technology.pdf
The Role of Electrical and Electronics Engineers in IOT Technology.pdfThe Role of Electrical and Electronics Engineers in IOT Technology.pdf
The Role of Electrical and Electronics Engineers in IOT Technology.pdf
 
Technical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prismsTechnical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prisms
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
 
6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
 
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdfTutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
 
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming PipelinesHarnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
 
Forklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella PartsForklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella Parts
 
DESIGN AND ANALYSIS OF A CAR SHOWROOM USING E TABS
DESIGN AND ANALYSIS OF A CAR SHOWROOM USING E TABSDESIGN AND ANALYSIS OF A CAR SHOWROOM USING E TABS
DESIGN AND ANALYSIS OF A CAR SHOWROOM USING E TABS
 

Static variables

  • 1.
  • 3. WHAT IS STATIC • Static is a keyword in C++ • Can be used with the following: • Variable declaration • Class data member declaration • Allocated storage on static storage area. • Local variable gets storage on stack, whereas global variables, arrays, pointers gets storage on heap.
  • 4. DECLARING STATIC VARIABLE • A variable is declared as static by writing the keyword static in front of variable declaration. • For example: • static int a; //declaring static variable int main() { int a; } int main() { static int a; } LOCAL / AUTOMATIC VARIABLE STATIC VARIABLE
  • 5.
  • 6.
  • 7.
  • 8. SOME IMPORTANT POINTS ABOUT STATIC VARIABLE: • The default value of a static variable is always 0. • The scope or lifetime of a static variable is not only within the function but is within the whole program. • Static variable is initialized only once i.e. it cannot be reinitialized again and again when a function will be called many times.