Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
thelopa
· 3y ago · 0 comments
Many of the str functions in the C standard library assume a nul terminator.
Comments
[–]
adastra22
3y ago
Yes, but aside from string literals pointed out by a sibling comment, nothing in the language itself dictates this convention. The C library could be augmented with functions which expect strings structured in other ways.
[–]
ixtenu
3y ago
> nothing in the language itself dictates this convention.
String literals are nul-terminated, e.g.: "foo"[3] == '\0'