I am trying to convert and store an integer into a char pointer. So far this is what I have.
char * str1;
sprintf(str1,"%d",10);
I keep getting a Segmentation fault
error.
If the code below works then why doesn't the above?
char * str1;
str1 = "Hello World";
printf("%s\n", str1);