Possible Duplicate:
Good STL-like library for C
Are there any open source C libraries with common data structures?
Is there a "standard" library that C programmers use for frequently-used data structures (hash/tree-based sets/maps, heaps, etc.)? Or is there no single, well-known implementation?
(Something kind of like Boost for C++?)
If the structures are of compatible types, yes, you can, with something like: memcpy (dest_struct, source_struct, sizeof (*dest_struct)); The only thing you need to be aware of is that this is a shallow copy.
A surface copy (also known as shallow copy) simply copies references without creating copies of the data behind them: @original = ( \@a, \@b, \@c ); @surface = @original; A deep copy creates an entirely new structure with no overlapping references.
A nested structure in C is a structure within structure. One structure can be declared inside another structure in the same way structure members are declared inside a structure. Syntax: struct name_1.
See GLib or APR (Apache Portable Runtime) library, they are the most well-known C libraries for data structures.
http://developer.gnome.org/glib
http://apr.apache.org
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With