Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
3 views

Post-Mid-Week-1

Programming fundamentals

Uploaded by

asgharzainab877
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Post-Mid-Week-1

Programming fundamentals

Uploaded by

asgharzainab877
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Learn for Success

What does mean by variable Scope?


• The boundary or area in which variables are
accessible after the declaration are the scope
of these variables.
• Variable scope determine the accessibility of
variables
• There are two kinds of variable with respect to
scope
1. Local Variable
2. Global Variable
Learn for Success

Local Variables
▪ The variable which are declared inside the
block or function body is called local variables.
Learn for Success

Global Variables
▪ The variable which are declared outside from
all the functions and accessible throughout
the program are known as global variables
Learn for Success

What does mean Life time of variables


▪ Life time of variable mean duration for which
variable exist in memory
▪ Variable life time start when a memory is
allocated to a variable
▪ Variable life time ends when a memory is
deallocated from variable
Learn for Success

Life time of local variable


▪ Life time of local variable start when control
enter inside the function or block where
variable is declared
▪ Life time of local variable ends when control
exit from the function or block where variable
is declared
Learn for Success

Life time of Global variable


▪ Life time of global variable start when
program execution start
▪ Life time of global variable ends when
program execution end
Learn for Success

PRACTICAL DEMO

You might also like