Skip to content · ⁨الانتقال إلى المحتوى⁩

Booleans and selection: if, else, switch · ⁨المنطقيات والاختيار: if، else، switch⁩

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 ليس لديها نوع منفصل للصحيح/الخاطئ بشكل افتراضي. تستخدم الأرقام: 0 تعني خطأ، و أي رقم آخر يعني صحيح.
  • اختبار مثل 5 > 3 ينتج 1 (صحيح). 5 < 3 ينتج 0 (خطأ).
  • (إذا كنت تستخدم #include <stdbool.h> يمكنك كتابة bool، true، و false — لكن int العادي يعمل في كل مكان.)

Handout · ⁨ورقة عمل⁩

Log in or create account · ⁨تسجيل الدخول أو إنشاء حساب⁩

IGCSE, A-Level & AP