I'm reading Yung-Hsiang Lu's book, Intermediate C Programming, and I'm working through the chapter on stack memory. When defining the value address he provides this code example:
int f1(int k, int m)
{
return (k + m);
}
void f2(void)
{
int u;
u = f1(7, 2);
// RL A
}
He goes on to describe how in the example above, the address of u is stored before f1 is called in what he calls the value address because it is the address where the return function of f1 is stored.
In the frame of f2, u is stored at some address (say 100) with a garbage value. Then when f1 is called, the stack proceeds in the frame of f1 with a return location at RL A, a value address with value 100, and addresses for m and k. Execution of f1 yields the value 9, which is written to the garbage value at address 100. Then after f1's frame pops, the call stack will consist of frame f2 with symbol u at address 100 with value 9.
So far so good -- but where I'm unclear is what the value address of frame f1 would be if instead of u = f1(7, 2) we had u = f1(7, 2) + 5 or if u were some other function of f1 not equal to f1. It doesn't seem to me that the value of f1 would be simply written to the original garbage value in such a case, since u isn't equal to f1.
So I think I'm maybe not understanding what exactly he means with the "value address".
Can anyone clarify?