Possible Duplicate:
What is the difference between char a[] = “string” and char *p = “string”?
What is the difference between using memcpy on stack memory vs on heap memory? The following code works on Tru64 but segfaults on LINUX
char * string2 = " ";
(void)memcpy((char *)(string2),(char *)("ALT=---,--"),(size_t)(10));
The second version works on LINUX
char * string2 = malloc(sizeof(char)*12);
(void)memcpy((char *)(string2),(char *)("ALT=---,--"),(size_t)(10));
Can someone explain the segfault on LINUX?