Skip to content · ⁨Saltar al contenido⁩

Strings: char arrays and the null terminator · ⁨Cadenas: arreglos de caracteres y el terminador nulo⁩

English

Text is an array of chars

  • C has no separate string type. A string is just an array of char.
  • char word[] = "hi"; actually stores 'h', 'i', and a hidden '\0' at the end.
  • You can read one character at a time with an index, exactly like any array.
Español

El texto es un array de chars

  • C no tiene un tipo de cadena separado. Una cadena es simplemente un array de char.
  • char word[] = "hi"; en realidad almacena 'h', 'i' y un '\0' oculto al final.
  • Puedes leer un carácter a la vez usando un índice, exactamente como con cualquier array.

Handout · ⁨Material⁩

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

IGCSE, A-Level & AP