SCOPE AND STORAGE CLASS





SOURCE CODE

#include “iostream.h”
#include “conio.h”
#include

extern i=10;

class var
{
public:
void first();
void second();
};

void main()
{
clrscr();

var v;
v.first();
v.first();
v.second();
getch();
}

void var::first()
{
static int s=1;
auto int a=20;
register int r=30;
cout << "i= " << s= " << s << endl << " a= " << a << endl << " r= " << r << endl << endl; i++; s++; a++; r++; } void var::second() { int n=5; cout << ">0)
{
int n=1;
cout << "Value Of n Inside The Block Is " << size="4">OUTPUT
i= 10
s= 1
a= 20
r= 30

i= 11
s= 2
a= 20
r= 30

Value Of n Outside The Block Is 5
Value Of n Inside The Block Is 1
Value Of n Outside The Block Is 6