What should happen in the following case:
int functionA() { return 25; } void functionB(const int& ref) { cout << ref << endl; } void start() { functionB(functionA()); }
When compiling this example, it displays the correct value of 25. How does it work? Should the excluded reference value on the stack be deleted (removed from the stack) when using only a reference to it or undefined behavior?
c ++ stack pass-by-reference reference return-value
maxdev
source share