C - Address of variables in the activation records
What's the quickest, easiest way to开发者_开发技巧 find the memory address of the first local variable in the activation record? (In C..)
Doesn't matter what we have declared already. Could be simple as char *s = 'Hello world!'
Thanks!
You can't do that - the C standard doesn't even require that there is a stack, let alone requiring a standard way to find out the order in which variables were put on it.
There is no portable way to do this in C. Any attempt to do this would be platform- and calling convention-specific.
精彩评论