Lecture39 - ComputerProgrammingITAC162. Tobediscussedtoday....

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Computer Programming I TA C162 . 19 Apr 2006 To be discussed today…. . Variable Storage classes in C Scope rules visibility and life time Examples
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 Computer Programming I TA C162 . 19 Apr 2006   Variable storage classes in C Automatic Variables External Variables Static Variables Register Variables Broad classification of variables: Local (Internal) Global (External) Note: Concept useful in multifunction program
Background image of page 2
3 Computer Programming I TA C162 . 19 Apr 2006 Scope, Visibility and Lifetime of Variables Scope determines over what region of the program a variable is active. Lifetime refers to the period during which a variable retains a given value. Visibility refers to the accessibility of a variable from the memory.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4 Computer Programming I TA C162 . 19 Apr 2006 How automatic variables work? void fun1(void) { int x=25; fun2(); printf(“%d\n”,x); } void fun2(void) { int x=5; printf(“%d\n”,x); } void main() { int x=125; fun1(); printf(“%d\n”,x); } Execution completed Output: 5 25 125
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 05/14/2010 for the course CS SS ZG653 taught by Professor Shanta during the Spring '09 term at Birla Institute of Technology & Science.

Page1 / 13

Lecture39 - ComputerProgrammingITAC162. Tobediscussedtoday....

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online