Skip to content · ⁨Pular para o conteúdo⁩

Booleans and selection: if, else, switch · ⁨Booleans e seleção: 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.)
Português

Verdadeiro e falso em C

  • C não tem um tipo true/false separado por padrão. Usa números: 0 significa false, e qualquer outro número significa true.
  • Um teste como 5 > 3 produz 1 (true). 5 < 3 produz 0 (false).
  • (Se você #include <stdbool.h>, pode escrever bool, true e false — mas o int simples funciona em todos os lugares.)

Handout · ⁨Material de apoio⁩

Log in or create account · ⁨Entrar ou criar conta⁩

IGCSE, A-Level & AP