0

Hello All
Can anyone provide me a sample code, executing which generates a segmentation falut. need to understand how it works.

Thanks.

4
Contributors
5
Replies
7
Views
8 Years
Discussion Span
Last Post by mvmalderen
0

thanks... i cud able to generate it now.. but i used some differerent way.

0

Hello All
Can anyone provide me a sample code, executing which generates a segmentation falut. need to understand how it works.

Thanks.

If you really want it:

for(int *p ;;) *p = 5;

Good luck with it :P

Edit::
But I really don't see how you'd understand it better, in programming, you just have to avoid this.
The only thing you really have to understand about this is that you never write some data to random memory.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.