Storage class

3,442 views
3,428 views

Published on

Published in: Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
3,442
On SlideShare
0
From Embeds
0
Number of Embeds
1,579
Actions
Shares
0
Downloads
93
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Storage class

  1. 1. C Programming Language By: Yogendra Pal yogendra@learnbywatch.com Dedicated to My mother and Father
  2. 2. Keep your notebook with you. Write important point and questions that comes in your mind Solve Mind band exercise. Rewind when not clear Ask Questions by call or SMS or by mail Keep Watching Keep Learning THIS IS STORAGE CLASS
  3. 3. Introduction • Variables have data types and storage classes. • Value in a computer can be stored in – Memory or – CPU registers • A storage class determines where to store the value of a variable.
  4. 4. Storage class • Storage class determines • 4 storage classes – Where to store – Automatic – Default initial value – Register – Scope – Static – Life – External
  5. 5. Automatic • Keyword: auto • Default storage class. – Where : Memory – Initial value : Garbage – Scope : Local to the block – Life : Till control remain within the block.
  6. 6. Register • Keyword: register • Faster access then automatic. – Where : CPU registers – Initial value : Garbage – Scope : Local to the block – Life : Till control remain within the block. • Registers are limited. • If no register is free compiler treat it as auto.
  7. 7. Static • Keyword: static – Where : Memory – Initial value : Zero – Scope : Local to the block – Life : Persists between function calls. • Use when really required.
  8. 8. External • Keyword: extern • Define outside of each function. – Where : Memory – Initial value : Zero – Scope : Global – Life : Till program terminates • Use when really required.
  9. 9. To get complete benefit of this tutorial solve all the quiz on www.learnbywatch.com For any problem in this tutorial mail me at yogendra@learnbywatch.com with the subject “C” For Other information mail at info@learnbywatch.com

×