Lecture 15 & 16
Lecture 15 & 16
Wah Campus
A local variable with name x pushes a binding onto the global x stack
(which may have been empty), which is popped off when the control flow
leaves the scope
7. // Only declaration
8. void fun(); };
9. // Definition outside class using ::
10. void A::fun() { cout << "fun() called"; } fun() called
• }
prog.c:8:15: error: printf("%d", x);
'x' undeclared
In function 'main': // Error: x is not ^
(first use in this
function) accessible here
ASSIGNMENT 03
A data type refers to the type of value a variable has and what type of
mathematical, relational or logical operations can be applied without
causing an error
END
_______________________________