cp_1_lect_43 - Variable storage classes in Automatic...

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

View Full Document Right Arrow Icon
5/10/10 11 Variable storage classes in Automatic Variables External Variables Static Variables Register Variables Broad classification of variables: Local Global Note: Concept useful in multifunction program
Background image of page 1

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

View Full DocumentRight Arrow Icon
5/10/10 22 Scope, Visibility and 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. Inference: Visibility of the variable is within
Background image of page 2
5/10/10 33 How automatic variables 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(); Execution completed Output: 5 25 125
Background image of page 3

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

View Full DocumentRight Arrow Icon
5/10/10 44 How global variables work? int val ; int fun1(void) { val += 5; return val ; } int fun2(void) { int val =0; return val ; } void main() { val = 5; printf(“val= %d\n”,val);
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/07/2010 for the course CS&IS TA C162 taught by Professor Kavitha during the Spring '09 term at Birla Institute of Technology & Science.

Page1 / 10

cp_1_lect_43 - Variable storage classes in Automatic...

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