+ 1
Is the first variable declared in C at the topmost point of the stack or not?
Suppose this code: char buf; *(&buf + 1) = 'a'; putchar(*(&buf + 1)); Where does character 'a' get stored, if &buf is at the top of the stack?
3 Respostas
+ 1
Martin Taylor In SoloLearn, the first variable declared has the highest address. So what occurs above the stack, here? I had thought that in C, there is a direct connection between the variable-number and the position of it on the stack.
+ 1
Martin Taylor Thank you for the explanation. That really helped me.
0
Martin Taylor So the compiler checks for such situations and raises an error when such a thing happens. Thanks for the explanation.