When a segmentation fault occurs, the printf() before it does not execute.
main()
{
printf( "something" );
statement; //this statement causes a segmentation fault
}
In the situation above, why does the printf() not execute?
So do I need to use valgrind in such a case(which prints all printf() before the faulty statement).
An output stream can fail to be output before a program crash but you can force the bytes to be output by flushing them with fflush().
I usually do it with something like this: