C - Address of variables in the activation records

199 Views Asked by At

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!

2

There are 2 best solutions below

1
On BEST ANSWER

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.

0
On

There is no portable way to do this in C. Any attempt to do this would be platform- and calling convention-specific.