Say you have a C code like this:
#include
int main(){
printf("Hello, world!\\n");
printf("%d\\n", f());
}
in
18 is the return value of the first print statement. (the number of characters printed)
This value is stored in stack memory.
In second printf function the stack value is 'returned' by function f. But f just left the value that printf created in that slot on the stack.
for example, in this code:
#include
int main(){
printf("Hello, world!1234\n");
printf("%d\n", f());
}
int f(){
}
Which compiles fine with gcc, and the output (on my system) is:
Hello, world!
18
for details of printf() returning value mail me.