c / beginner
Snippet
String Null Terminator
In C, strings are null-terminated, meaning they always end with a hidden '\0' character to mark the end of the text.
snippet.c
c
1
2
char word[] = "C";// Memory: ['C', '\0']
Breakdown
1
"C"
A string literal. Even though it looks like 1 character, it occupies 2 bytes in memory.
2
'\0'
The null character that tells functions like printf where the string stops.