I'm not asking what stack/heap/static mean or what is the different between them. I'm asking which area a const object in?
C++ code:
#include <cstdio>
using namespace std;
const int a = 99;
void f()
{
const int b = 100;
printf("const in f(): %d\n", b);
}
int main()
{
const int c = 101;
printf("global const: %d\n", a);
f();
printf("local const: %d\n", c);
return 0;
}
which memory area are a
, b
, and c
in? and what are the lifetime of them?
Is there any differences in C language?
What if I take their address?