When I execute the code below,
#include <stdio.h>
#include <string.h>
int main ( ){
char string [] = "Home Sweet Home";
printf ("%s",(char*)memmove(string,&string[5],10));
}
the output is "Sweet Home Home".
But; when I change the code like below,
#include <stdio.h>
#include <string.h>
int main ( )
{
char* string = "Home Sweet Home";
printf ("%s",(char*)memmove(string,&string[5],10));
}
it gives segmentation fault.
What changes when I define this array as a char pointer?