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