I am trying to figure out a way to remove a char from a string based on an index value using pointers and not touching array notation (by which I essentially mean not using any brackets) at all. As far as I understand *letter = temp should assign what is in temp into the location of letter, but it creates a segmentation fault instead.
char *word = "blue";
int length = strlen(word);
int index = 0;
for (index; index < length; index++)
{
char *letter = word + index;
char temp;
temp = *(letter + 1);
*letter = temp;
}
printf("%s\n", word);
Edit: Bolded something that the answers seem to be ignoring.