This is a question from the latest version of Stroustrup "C ++ Programming Language".
I have been pondering this in my head for the last couple of days.
The only thing I can think of, (and this is probably wrong), looks something like this:
int* f(int n) {
int* a = &a - n * sizeof(int*);
return a;
}
My intention is to get the address of something higher in the stack. Does that make sense? Does anyone have any other answers? Remember that this is in chapter 5 (pointers, arrays, and structures), so the answer should not include something later in the book.
source
share