Skip to content · ⁨コンテンツへスキップ⁩
English

True and false in C

  • C has no separate true/false type by default. It uses numbers: 0 means false, and any other number means true.
  • A test like 5 > 3 produces 1 (true). 5 < 3 produces 0 (false).
  • (If you #include <stdbool.h> you can write bool, true, and false — but plain int works everywhere.)
日本語

C での真偽値

  • C にはデフォルトで独立したtrue/false型はありません。数字を使います:0 はfalse、それ以外の数はtrueです。
  • 5 > 3 のようなテストは 1 (true) を生成します。5 < 3 は 0 (false) を生成します。
  • (#include <stdbool.h> なら bool 、true 、false を書けますが、標準の int はどこでも機能します。)

Handout · ⁨プリント⁩

Log in or create account · ⁨ログインまたはアカウント作成⁩

IGCSE, A-Level & AP