Memory allocation in case of static variables
Posted
by eSKay
on Stack Overflow
See other posts from Stack Overflow
or by eSKay
Published on 2010-03-08T17:44:20Z
Indexed on
2010/03/08
17:51 UTC
Read the original article
Hit count: 594
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)
?
© Stack Overflow or respective owner