Question

Just interested. I'm revising my long forgotten rusty knowledge of C and am wondering in C where are the identifiers for declared variables stored?

For example if I declare the following char value1 in main.

int main(){
char value1 = 'A';
  return 0;
}

I know that the char will be stored at in a the stack in the Stack Frame for main. Lets say if we did an address off on on value1 like this &value1. We would get something like 0xF37012 ( a hypothetical number). This would be where the value is located, but what about the identifier? and how is this associated with 0xF37012? Is it in the stack frane for main someplace? Or do all all identifiers get stored on some global table, or list?

Was it helpful?

Solution

Unless you have compiled specifically for debugging, the identifiers are NOT stored. If you did set the debuggability option when you compiled, there will be symbol tables associated with functions/stack-frames/static storage which provide those mappings.

OTHER TIPS

some identifier will be optimized while compiling, unless generated debug informations.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top