Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

std::vector alternative for C [closed]

I wonder if there is an alternative for the std::vector in C? I found this implementation but it seems to contain some issues with memory reallocation.

like image 298
ezpresso Avatar asked Feb 07 '11 17:02

ezpresso


2 Answers

You can give glib and its arrays (GArray) a try.

glib is actively maintained, cross platform, open source (LGPLv2+), and it doesn't stop on arrays/vectors. You also have hash tables, linked lists, queues and many other data structures.

like image 99
Pablo Santa Cruz Avatar answered Oct 19 '22 11:10

Pablo Santa Cruz


While reading C Array vs. C++ Vector, I found an interesting implementation of a simple vector container in C, which also includes push/pop operations. It's worth reading it!

like image 28
The Guy Avatar answered Oct 19 '22 10:10

The Guy