Y
Hacker News
new
|
ask
|
show
|
jobs
by
thelopa
1111 days ago
Many of the str functions in the C standard library assume a nul terminator.
1 comments
adastra22
1111 days 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.
link
ixtenu
1111 days ago
> nothing in the language itself dictates this convention.
String literals are nul-terminated, e.g.: "foo"[3] == '\0'
link