Skip to content · ⁨Saltar al contenido⁩

Booleans and selection: if, else, switch · ⁨Booleanos y selección: 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.)
Español

Verdadero y falso en C

  • C no tiene un tipo separado de verdadero/falso por defecto. Usa números: 0 significa falso, y cualquier otro número significa verdadero.
  • Una prueba como 5 > 3 produce 1 (verdadero). 5 < 3 produce 0 (falso).
  • (Si incluyes #include <stdbool.h> puedes escribir bool, true y false — pero int puro funciona en todas partes.)

Handout · ⁨Material⁩

Log in or create account · ⁨Iniciar sesión o crear cuenta⁩

IGCSE, A-Level & AP