Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jul 2nd, 2007, 12:19 PM   #1
thenewkid
Programmer
 
Join Date: Sep 2004
Location: New Jersey
Posts: 36
Rep Power: 0 thenewkid is on a distinguished road
Send a message via AIM to thenewkid
C data structures lib?

Hey all, just a quick question...does C standard library provide a developer with basic data structures such as stacks, lists or trees? etc... and if it does, which header files should i include in order to use them? I googled for the answer, but all results were pointing to implementations which haven't been standardized. Thanks in advance.
thenewkid is offline   Reply With Quote
Old Jul 3rd, 2007, 6:00 AM   #2
Fall Back Son
Professional Programmer
 
Join Date: Oct 2006
Posts: 311
Rep Power: 3 Fall Back Son is on a distinguished road
I'm fairly sure that isn't the case. In C, a linked list is a structure with a pointer link pointing to the next structure in the list. Stacks and Queues are possible implementations of linked lists.
Fall Back Son is offline   Reply With Quote
Old Jul 3rd, 2007, 12:22 PM   #3
thenewkid
Programmer
 
Join Date: Sep 2004
Location: New Jersey
Posts: 36
Rep Power: 0 thenewkid is on a distinguished road
Send a message via AIM to thenewkid
So what you are saying is that every C programmer needs to implement his/her own data structures? I mean in many cases this is required as some date structures are particular to a given project or assigment, but something as common as a linked list?. That is pretty strange to me. It is not that im too lazy to implement my own, but it would be nice to have a well tested lib. at hand when needed you know.
thenewkid is offline   Reply With Quote
Old Jul 3rd, 2007, 12:41 PM   #4
Wizard1988
Professional Programmer
 
Wizard1988's Avatar
 
Join Date: Oct 2005
Location: Chitown
Posts: 422
Rep Power: 4 Wizard1988 is on a distinguished road
I thought you were asking if data structures were part of a standard library.
__________________

Wizard1988 is offline   Reply With Quote
Old Jul 3rd, 2007, 1:08 PM   #5
niteice
Programmer
 
niteice's Avatar
 
Join Date: Aug 2005
Posts: 98
Rep Power: 4 niteice is on a distinguished road
Send a message via AIM to niteice
There are plenty of libraries available, but you are correct in thinking that nothing is standardized.
niteice is offline   Reply With Quote
Old Jul 3rd, 2007, 1:53 PM   #6
thenewkid
Programmer
 
Join Date: Sep 2004
Location: New Jersey
Posts: 36
Rep Power: 0 thenewkid is on a distinguished road
Send a message via AIM to thenewkid
This makes some things clearer, thanks all for your replies.
thenewkid is offline   Reply With Quote
Old Jul 3rd, 2007, 7:19 PM   #7
lectricpharaoh
SEXY SHOELESS GOD OF WAR!
 
lectricpharaoh's Avatar
 
Join Date: Jun 2005
Location: Wet west coast of Canada
Posts: 1,198
Rep Power: 5 lectricpharaoh will become famous soon enough
C++, on the other hand, does have the Standard Template Library, which offers much of this functionality.
__________________
And once again, Probability proves itself willing to sneak into a back alley and service Drama as would a copper-piece harlot.
- Vaarsuvius, Order of the Stick
lectricpharaoh is offline   Reply With Quote
Old Jul 3rd, 2007, 7:36 PM   #8
Random-Spirit
Unverified User
 
Join Date: Jul 2007
Location: England
Posts: 22
Rep Power: 0 Random-Spirit is an unknown quantity at this point
>C++, on the other hand, does have the Standard Template Library, which offers much of this functionality.

Problem with that is to use it, even if you stick to the C subset of C++, you need a good understanding of C++. I am not saying your suggestion is not valid, its exactly what I was thinking. If the OP can only use C then C++ is not an option.

The OP is obviously worried about non-standard libraries. The problem with C is that its standard library is small in scope. Personally I just roll my own array list and linked list, they are not very hard to implement if you keep them simple. I have not made them into a library, all I usually do is just import the .c and .h files into my projects of my standard linked list. Stacks and queues can be easily adapted from those two data structures. Its actually quite fun to write your own data structures, though if you are new to C it can be a daunting but very educational exercise.
Random-Spirit is offline   Reply With Quote
Old Jul 3rd, 2007, 9:17 PM   #9
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
C is not strictly a subset of C++. There are perfectly valid C statements that will fail in C++. No understanding of C++ will allow one to take advantage of things like the STL when using C.

I'm not proposing that this is what you were saying, but it sounded like it.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Jul 4th, 2007, 5:30 PM   #10
Random-Spirit
Unverified User
 
Join Date: Jul 2007
Location: England
Posts: 22
Rep Power: 0 Random-Spirit is an unknown quantity at this point
>C is not strictly a subset of C++

Yes I know, keywords like restrict are in C99 but not in ISO C++ etc.

>No understanding of C++ will allow one to take advantage of things like the STL when using C.

So your saying if you do not understand how new and delete work or what references are or how templates function you can just jump in and use the STL?

>I'm not proposing that this is what you were saying, but it sounded like it.

Yes I am saying that unless you know some C++ it is not easy just to jump in and use the STL with great success.
Random-Spirit is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Data structures Mr M C++ 2 Jan 21st, 2007 9:30 PM
Arrays in data structures d_heyzie C++ 4 Apr 16th, 2006 10:01 AM
please help. hierarchical data structures. vitroblue C++ 5 Jun 26th, 2005 3:13 PM
Help in QBASIC (I think it's similar to VB) phoenix987 Visual Basic 3 May 9th, 2005 1:33 PM
Help with a QBASIC program phoenix987 Other Programming Languages 4 May 5th, 2005 1:27 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 12:49 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC