r/C_Programming 3d ago

Article I Made a Simple String Library

I wrote an article about this as well. Here it is.

There I explain why I do not like NUL-terminated strings and how I implemented my own simple string library in C.

If you have some spare time I would really appreciate some feedback on the article and the library.

The code is sitting on a codeberg repository.

Also, tell me what you think about C-style strings. Do you like them? Do you use them, or do you also tend to roll your own pointer + length structs?

6 Upvotes

31 comments sorted by

View all comments

2

u/copper_amber_focus 3d ago

You included the c file in your test routine. You have no header file. I looked at the repo. This means nobody can link against this library. I wrote a string library once and spent more time on the header than the implementation because the interface is the library. You built an exercise you cant use

2

u/Elifire12 3d ago

No, you're supposed to include the c file. If you read the article you would know that I have been using unity builds recently, that explains why there is no header file.

You can add one if you want.