C has no string type. A string is a row of char boxes with an invisible \0 marking the end.
1 char arrays
char name[5] holds 5 single characters — enough for "Lena" plus the terminator.
2 The \0 terminator
One byte, written '\0' in code, that ends the string. Making room for it is your job.
3 %s prints it
printf("%s", name) writes characters one by one until it hits \0.
4 Strings are mutable
Assign to any index — word[0] = 'f' turns "sun" into "fun" in place.
A string is a char array
char arrays1char name[5] holds 5 single characters — enough for "Lena" plus the terminator. The \0 terminator2One byte, written '\0' in code, that ends the string. Making room for it is your job. %s prints it3printf("%s", name) writes characters one by one until it hits \0. Strings are mutable4Assign to any index — word[0] = 'f' turns "sun" into "fun" in place. 4 building blocks make up A string is a char array
Every string walk is the same loop: process s[i], step i forward, stop at the terminator.
process decision input / output start / end Press play — the loop walks the letters one index at a time until it bumps into the invisible \0.
preprocessThe preprocessor pastes in stdio.h.
Memory
no variables yet — press play
Console
output appears as the program runs…
Click a term, then click its meaning to lock the pair.
5 conceptsTap a card to expand ?char s[10]drops into place
?\0drops into place
?%sdrops into place
?strlen(s)drops into place
?'A' vs "A"drops into place
Strings can be edited letter by letter — what survives the swap?
Your predicted output — one line per console line
Hint: word[8] holds s, u, n and the closing \0 — changing word[0] swaps the first letter in place.
01A C string is a char array ending in the invisible \0.
02Room for \0 is your job: "Lena" needs 5 boxes, not 4.
03%s prints from index 0 until the terminator.
04String walks stop at \0 — like while (s[i] != \0).
05"A" (double quotes) is a string with a hidden \0; 'A' (single quotes) is one plain char.