文字の配列を引数として取り、すべての文字を小文字に変換する単純な関数があります。ただし、奇妙なアクセス違反エラーが発生します。コードは次のとおりです。
void toLower(char *rec)
{
int i=0;
while (rec[i]!='\0')
{
if (rec[i]>='A' && rec[i]<='Z')
rec[i]='a'+rec[i]-'A'; //this is where I get an error - assigning the
//the value to rec[i] is the problem
i++;
}
}
私の間違いは何ですか?ありがとう