Function Life Cycle ,how it starts and ends (Prologue & Epilogue)

when we write a function in c lnaguage the compiler will create assembly code.
in accembly code of every functions body some extra assembly codes are inserted by compiler.
these are called Prologue and Epilogue:

these are required to save variables and return address.
because what if a function A called another function B.
to do this we should write parent functions A s details somewhere in memmory and we should jump to function B. so when function b exits we can come back to function A.
so its local variables willbe there, so execution resumes,

this controll flow is a builtin feature of compiler

Powered by Forestry.md