Cエラー[エラー]代入の左オペランドとして左辺値が必要
C Error Lvalue Required
/* test.c */ #include #include #include int main () { char *src = 'hello,My girlfriend' int len = strlen(src) char *dest = (char *)malloc(len) char *d = dest char *s = src[len] while (! len - = 0) // = should be changed to: == { d++=s-- } printf('%s',dest) return 0 }
[エラー]代入の左オペランドとして左辺値が必要です
理由:
計算値==! =
変数=
代入ステートメントの左側は、式ではなく変数である必要があります。実際、比較式があるので、関係演算子(==)の代わりに割り当て(=)を作成します