I\'m trying to compile and run following program without main()
function in C
. I have compiled my program using the following command.
In C, when functions/subroutines are called the stack is populated as (in the order):
main() being the start point, ELF structures the program in such a way that whatever instructions comes first would get pushed first, in this case printfs are.
Now, program is sort of truncated without return-address OR __end__
and infact it assumes that whatever is there on the stack at that(__end__
) location is the return-address, but unfortunately its not and hence it crashes.