Memory allocation in case of static variables
- by eSKay
I am always confused about static variables, and the way memory allocation happens for them.
For example:
int a = 1;
const int b = 2;
static const int c = 3;
int foo(int &arg){
arg++;
return arg;
}
How is the memory allocated for a,b and c?
What is the difference (in terms of memory) if I call foo(a), foo(b) and foo(c)?