I don't understand why when I run strcpy (ss, ss2) with char * ss and char * ss2 it shows segmentation fault. strcpy () just asks for 2 args of type char *, so I don't understand the problem
#include <stdio.h>
#include <string.h>
int main()
{
char *s;
char *s2 = "hello";
s = s2;
printf ("s=%s\ns2=%s\n", s,s2);
char *ss;
char *ss2 = "hello";
strcpy (ss, ss2);//why segmentation fault?
printf("ss=%s\nss2=%s\n",ss,ss2);
}
return 0;