I am trying to remove a character from a string knowing its position. I am aware that there are plenty of methods, but the one I tried out produces the error in the title on line 4 of the attached code. The objective of my attempt is to make the pointer on the old character point on the next character of the string. Can someone help me understanding this issue?
char* remove_char(char str[], int pos)
{
str = str[pos] + str;
if (pos < strlen(str)-1)
&(str[pos]) = &(str[pos+1]);
else
str[strlen(str)-1] = 0;
return str;
}