why does this code crashes even though everything is perfectly fine?
- by ashish yadav
why does this code crashes when executed even though everything is fine?
is using strcat illegal on character pointers?
#include <stdio.h>
#include <string.h>
int main()
{
char *s1 = "Hello, ";
char *s2 = "world!";
char *s3 = strcat(s1, s2);
printf("%s",s3);
return 0;
}
it should work fine but it isn't. please give a proper way with referring to both array and pointers.