文字列を反転する関数を作成しようとしていますが、実行中に次のような例外が発生しました: *str++ = *end; 何が理由か分かる人いますか?前もって感謝します。
void reverse(char* str)
{
char *end = str;
char temp;
if(str)
{
while(*end)
{
end++;
}
end--;
while(str<end)
{
temp = *str;
*str++ = *end;
*end--=temp;
}
}
}