Can someone please explain why this program works in sunstudio C compiler but 
seg faults in gcc:

#include <stdio.h>
#include <string.h>

int
main()
{
        char *ptr = "adam";

        strcpy(ptr, "eve");
        printf("%s\n", ptr);
}
 
 
This message posted from opensolaris.org
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to