Globals: An Example

Globals: An Example

int a; // a global variable

void f1(int b,int c)

{

int k; // local k

k = b*b;

a = k + c;

}

// a different b and c

void f2(int b,int c)

{

int k; // a different k

k = b + 2;

// the same a as before

a = k * c;

}

Previous slide Next slide Back to the first slide View Graphic Version