以下を含む行でセグメント違反エラーが発生します。
*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++);
}