mstdn.maud.io is one of the many independent Mastodon servers you can use to participate in the fediverse.
The place to express your ❤️ more freely. / あなたの「すき」をもっと自由に書き表すための場所。

Administered by:

Server stats:

349
active users

i = 10;
if(i=0){
printf("i=%d",i);
}

なんでこれの出力がi=0になるんだ??ってなっていたので私はアホ

@Otakan951 こういうのの防止に,比較式の即値は右ではなく左に書く流派があるよ(0=i はコンパイルエラー)

@Otakan951 あとなんですがそもそもコンパイラの警告(gcc なら -Wall -Wextra)を付けておけば if の条件式で代入だけやってるコードは warning が出るので普段から warning を全部出して,それが消えるようにコーディングする癖付けたら良いよ。