How do called functions return to their caller, after being called?
I read that when a function call is made by a program, the called function must know how to return to its caller. My question is: How does the called function know how to return to its caller? Is there a mechanism working behind the scenes through the compiler? The compiler obeys a particular "calling convention", defined as part of the ABI you're targeting. That calling convention will include a way for the system to know what address to return to. The calling convention usually takes advantage of the hardware's support for procedure calls. On Intel, for example, the return address is pushed