Your SlideShare is downloading. ×
Scope - Static and Dynamic
Scope - Static and Dynamic
Scope - Static and Dynamic
Scope - Static and Dynamic
Scope - Static and Dynamic
Scope - Static and Dynamic
Scope - Static and Dynamic
Scope - Static and Dynamic
Scope - Static and Dynamic
Scope - Static and Dynamic
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Scope - Static and Dynamic

6,766

Published on

This presentation is about scope and its types as static and dynamic.

This presentation is about scope and its types as static and dynamic.

Published in: Education, Technology, Business
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
6,766
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
143
Comments
0
Likes
2
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. PRINCIPLE OFPROGRAMMING LANGUAGES SCOPESTATIC AND DYNAMIC SNEH PAHILWANI SYMBIOSIS INSTITUTE OF TECHNOLOGY
  • 2. In computer programming, a scope is thecontext within a computer program in whicha variable name or other identifier is valid andcan be used, or within whicha declaration has effect.Outside of the scope of a variable name,the variables value may still be stored, andmay even be accessible in some way, but thename does not refer to it; that is, the name isnot bound to the variables storage.
  • 3. SCOPESTATIC DYNAMIC
  • 4.  Also called lexical scoping. If a variable names scope is a certain function, then its scope is the program text of the function definition: within that text, the variable name exists, and is bound to its variable, but outside that text, the variable name does not exist.
  • 5. Output:23•Encounter occurrence of„x‟.•Search local blockvariables•If not there, keepsearching in parent blocks.•If not there too, in globalscope then.•Otherwise „error‟
  • 6. SCOPESTATIC DYNAMIC
  • 7.  In dynamic scoping (or dynamic scope), if a variable names scope is a certain function, then its scope is the time-period during which the function is executing. While the function is running, the variable name exists, and is bound to its variable, but after the function returns, the variable name does not exist.
  • 8. Pointing the difference out•Under static scoping: prints out22•Under dynamic scoping: prints out34•At “runtime” one searches forthe declaration•Search in local variables•If not found, search in localvariables of the caller•If not found, search in globalvariables•Otherwise error
  • 9. www.wikipedia.orghttp://cseweb.ucsd.edu/cl asses/sp05/cse130/lecture_ notes/scoping_student.txt

×