I was doing some testing with stack, and noticed that I can't change the return address of the main()-function. Why it's not working? Isn't the return address supposed to be in the stack? I managed to change the return address in one of my functions but not in main... Seems like it doesn't have return address or I can't get to it. Does anyone know what is the problem? Some of my code:
If I give random input, return address doesn't change(debugged with gdb), but if I put those instructions to a function, it changes the return address? Anyone have any information about stack when main() is called? Platform is Linux, compiler gcc. Appreciate your help!Code:#include <stdio.h> int main() { char c[4]; gets(c); return 0; }