[Updated] Goldman Sachs Aptitude Test Questions and Answers
Practice List of TCS Digital Coding Questions !!!
Take 50+ FREE!! Online Data Interpretation Mock test to crack any Exams.
Interview Questions and Answers :: HCL Technologies

11. Can you tell me simple program of stack corruption.

Answer:


#include

int main(void)
{
int a=0;
a = 1;
main();

return 0;
}


In the above piece of code, we declare a variable 'a' inside main() and recursively call main() again and again. Now since every time main() gets called, a memory chunk on stack is allocated for main() again and again. Now, lets run the code :

Post Your Answer Here:      Public      Private

Rate This: +0 -0
Report     

Post Your Reply Here:     

Report Error

Report Error

Please Login First Click Here