I am new to this forum.I am having a bit of problem while coding a program. I am facing a segmentation fault.
Now I get the output till the printf...
printf("Can i be seen!!");
//some code here
printf("Can come here without any problem");
I even get the message
Can come here without any problem
But get a segmentation fault immediately.
I am not understanding why i am getting this message...
Can anyone help me...
Use fprintf(stderr...) or cerr for this kind of thing. Stdout (which printf uses) is buffered, meaning you can loose messages during segfaults which will mislead you.
I have no idea about your current problem tho. What OS are you on?
I am using Ubuntu lucid lynx 10.04 and using a g++ compiler...
This is not the actual code but the actual code is similar
Does the code you supplied exhibit the problems you are reporting? If not post a sample of the code that illustrates the problem.
No, it's not all his code. Instead it's all his code that couldn't cause a seg fault. :)
> This is not the actual code but the actual code is similar
Then you basically destroyed whatever the bug was.
Feel free to edit down a copy of your code to a small example which still shows the same problem (delete everything that would run AFTER the problem for example).