2013-07-14 04:40:58 UTC
char *string= '+' ;
*(string + 1)='\0' ;
puts(string);
in a program..The program crashes after reaching this line of code.
But if i declare it as follows no error occurs:
char *string;
string = (char*)malloc(2);
*string = '+';
*(string+1) = 0;
puts(string);
Please tell me why it happens.