Skip to content · ⁨Passer au contenu⁩

Strings: char arrays and the null terminator · ⁨Chaînes : tableaux de caractères et terminateur nul⁩

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.
Français

Le texte est un tableau de chars

  • C n'a pas de type chaîne séparé. Une chaîne est simplement un tableau de char.
  • char word[] = "hi"; stocke en réalité 'h', 'i', et un '\0' caché à la fin.
  • Vous pouvez lire un caractère à la fois avec un index, exactement comme n'importe quel tableau.

Handout · ⁨Fiche de cours⁩

Log in or create account · ⁨Se connecter ou créer un compte⁩

IGCSE, A-Level & AP