我在包含以下内容的行中收到段错误错误:
*pointer++ = *pointer_2++
不知道为什么。
字符串被声明为(在我的主目录中):
char *str = "Why doesn't this function work?"
这是我的功能:
void removewhitespace(char *str)
{
        // remove whitespace from the string.                                   
  char *pointer = str;
  char *pointer_2 = str;
 do{
    while (*pointer_2 == ' ' || *pointer_2 == '\n' || *pointer_2 == '\t')
      pointer_2++;
  }while (*pointer++ = *pointer_2++);
}