ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I'm an older, 'junior-ish' senior CS student, about to begin taking some heavy C courses. My school teaches Java as introductory courses, and while I've had a couple low-level courses (ASM, digital logic, brief intro to C), I really haven't had much experience with C. I've been reading up on Kernighan and Ritchie's C book ("The C Book"), did a ctrl+f on "linked list," didn't find much. Did some e-sleuthing, and it appears you need to create a linked linked list from scratch (and I assume the same follows for other common higher-level data structures, like maps, trees, et al.)
I may have missed something, but have these complex data structures been built in to any free, standard libraries, er?? I understand the nature of C, and that it's low-level, got the pointers, and the structs-as-opposed-to-classes, but....I have trouble believing headers/libs don't exist for creating these.
Hi,
I don't know of any libraries that provide these structures for C. I think you really need to write those from scratch. More over, if you have list of, say, ints and a list of floats, you'll either have to implement the list (or whatever) structure for both these types separately, or do some nasty things with typecasting or maybe some ugly macros. That's probably one of the good reasons to use C++ instead. You don't lose anything - you can still write procedural code just like in C if you wish, almost anything you can do in C is valid in C++ too, but in addition, you get some nice features like templates and function overloading, which will make your life much easier. Also, the standard C++STL library contains a lot of useful structures such as lists, vectors, maps, queues etc that will work with practically any type.
Hope this helps
Thanks for the info, guys. I definitely plan to use C++ whenever possible as I understand the libraries do have support for these higher-level structures (as you confirmed, millgates). Many thanks also for the link to the GLib page, TexMex. So that's what those glibc packages I've been seeing for years are all about. Should come in handy in the future!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.