Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
このコードを C コンパイラ (Dev Cpp) に入れました。
char *str = "SomeTHing"; for(int i = 0; str[i]; i++){ str[i] = tolower(str[i]); }
これによりセグメンテーション違反が発生しますが、静的配列を使用すると、
char str[10] = "SomeTHing";
ループは正常に動作します。なぜこれが起こっているのか誰にもわかりますか?