C has no string type. A string is an array of char that ends with the invisible null terminator '\0'.
1 Just char arrays
A C string is a char array whose last element is '\0' — the terminator that marks the end.
2 Length is computed
strlen walks the array counting characters until it hits the terminator. No length is stored anywhere.
3 The library helps
string.h gives you strcpy, strcmp, strcat and more — but each one is just a small loop you could write yourself.
4 Always leave room
A string with n visible characters needs n + 1 cells: one extra for the terminator.
What is a C string?
Just char arrays1A C string is a char array whose last element is '\0' — the terminator that marks the end. Length is computed2strlen walks the array counting characters until it hits the terminator. No length is stored anywhere. The library helps3string.h gives you strcpy, strcmp, strcat and more — but each one is just a small loop you could write yourself. Always leave room4A string with n visible characters needs n + 1 cells: one extra for the terminator. 4 building blocks make up What is a C string?
The loop is the whole trick: keep walking until the terminator shows up.
process decision input / output start / end Press play — watch the counter walk "code" one cell at a time, then watch a copy loop fill dst.
preprocessThe preprocessor pastes in stdio.h — printf comes from there.
Memory
no variables yet — press play
Console
output appears as the program runs…
Click a term, then click its description to lock the pair.
5 conceptsTap a card to expand ?'\0'drops into place
?strlen(s)drops into place
?strcpy(dst, src)drops into place
?strcmp(a, b)drops into place
?%s in printfdrops into place
A string is measured, then edited — what does the printout say?
Your predicted output — one line per console line
Hint: strcpy puts "cat" in; strlen counts 3 before the swap — and word[0] = 'b' only changes the first cell.
01A C string is a char array ending with the hidden \0 terminator.
02strlen counts by walking to the terminator — the length is never stored.
03strcpy copies the terminator too, so the destination stays a valid string.
04strcmp returns 0 for equal strings — remember: 0 means "same".
05Reserve n + 1 cells for n visible characters.