this post was submitted on 17 Aug 2026
7 points (88.9% liked)
C Programming Language
1341 readers
1 users here now
Welcome to the C community!
C is quirky, flawed, and an enormous success.
... When I read commentary about suggestions for where C should go, I often think back and give thanks that it wasn't developed under the advice of a worldwide crowd.
... The only way to learn a new programming language is by writing programs in it.
- irc: #c
๐ https://en.cppreference.com/w/c
founded 3 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Before trying to learn and use the standard library, I'd advise you to write a few simple functions yourself:
void print_until(const char* str, char c)- print every character in str until you see c or null (Note: Don't print the c or null, which should ensure that a str that only contains a \0 doesn't crash.)const char* print_until_2(const char* str, char c)- as before, but return the pointer to where you found c or nullvoid print_delimited_by(const char* str, char delimiter, char separator)- use print_until_2 in a while-loop, don't print the delimiter, but do print a separator.For example,
print_delimited_by("1;2;3",';',',')should print 1,2,3.Finally,
void num_delimited_by(const char* str, char del)- like print_delimited_by, but add a number before every output, and use newline as the separator.These fundamental string exercises will give you a solid foundation for understanding oantby's explanations about the standard library. Note that no memory allocation is necessary.
That's a good idea, I'll do these exercises, thanks!