how to view a core dump file

by what name does a core dump file stored???

like i wrote a test code:

//dump.c

main()
{
char *p=NULL;
printf("%s",p);
}

of course the above code will produce a segmentation fault. but i cant see any file named core in my CWD. am using SUN0S 5.9

You have some very strange behavior if that causes a segfault.

whats so strange about it buddy. Of course trying to dereference a NULL pointer will cause a SEGMENTATION FAULT.

See this article you will need "more coding" in your C program to generate core dumps.

am not able to open that link. guess it has been removed. can you tell me this "do all segmentation call produce core dump". if NO, then when will a segmentation fault produce a core dump

I can open that link fine. :confused:

Dereferencing a null pointer is illegal, but illegal behavior does not have guaranteed results. It may or may not cause a core dump.

I'll instruct you despite your tone.
That's not an invalid memory location (your NULL pointer is a misleading term), it's a pointer to type char assigned NULL. There is a valid memory location assigned to this pointer but no additional storage has been allocated. Thus the assignment of NULL and the printing of the assignment is perfectly legal.

printf("Pointer at %p and value assigned =%s\n",&p,p);

Perhaps this is what you meant to say would segfault as it is a dereference.

printf("%c",*p);