What is supposed to 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 outputs the correct value 25. How does this work? Should'nt the referenced return value on the stack be deleted (removed from the stack) when using only a reference to it, or is the behaviour undefined?