while this Code works:
char * k = "asd";
char * j = malloc(sizeof(char) * 3);
memmove(j,k,3);
printf("%s",j);
while code gives error:
char * k = "asd";
char * j = malloc(sizeof(char) * 3);
memmove(k,k+1,3);
printf("%s",k); // output should be "sd"
I am thinking wrong? Why it gives an erorr? I'm planning to use it for deleting the multiple whitespaces ("aaa.......bbb"(dots are spaces) -> "aaa bbb")
Thank you.