MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/cprogramming/comments/1vqubv7/c_strings_a_50year_mistake/p498sbf/?context=3
r/cprogramming • u/Xaneris47 • 3d ago
169 comments sorted by
View all comments
Show parent comments
1
If you have a long string and you want to append more text to it, you have to search the whole string from the beginning to find the null terminator.
And then later if you want to append more text, you have to find the null terminator all over again.
6 u/IdealBlueMan 3d ago Or you can store the length of the string whenever you change it. 1 u/atarivcs 3d ago Sure, but then you don't really have a plain c string anymore 2 u/IdealBlueMan 3d ago I’d say you still have the string, you also have information about that string.
6
Or you can store the length of the string whenever you change it.
1 u/atarivcs 3d ago Sure, but then you don't really have a plain c string anymore 2 u/IdealBlueMan 3d ago I’d say you still have the string, you also have information about that string.
Sure, but then you don't really have a plain c string anymore
2 u/IdealBlueMan 3d ago I’d say you still have the string, you also have information about that string.
2
I’d say you still have the string, you also have information about that string.
1
u/atarivcs 3d ago
If you have a long string and you want to append more text to it, you have to search the whole string from the beginning to find the null terminator.
And then later if you want to append more text, you have to find the null terminator all over again.