Thread: C data structure

  1. #1
    Registered User
    Join Date
    Sep 2006
    Posts
    12

    Smile C data structure

    Hi all:

    I notice that in C's built in library, it does not have some common data structures and sort rountines, such as stack, queue, linkedList, mergeSort, and quickSort. So I guess that we need to write our own data structure. ---1

    I also notice that there are many source codes for data structure in C online. But unlike C++, C does not have template, so what I guess that when we use those available codes, we must modify them to make them meet for our own need. ---2

    Am I right in these two ideas? Any reply will help! Thanks!!

  2. #2
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    Sometimes library functions (such as qsort()) take void pointers as arguments, so they can be passed anything, much like templates.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  3. #3
    Registered User
    Join Date
    Sep 2006
    Posts
    12
    Thanks! I also post a similar question on the forum you inidicated.

  4. #4
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    You might have better luck here.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  5. #5
    Registered User
    Join Date
    Aug 2006
    Posts
    11
    As far as I know there is no a "unique" solution. GCC and GLIBC provides many "hidden" utilities to manage trees, hashes, queues, a long list
    The STANDARD C itself does not solve your questions as such things are considered to be solved trough libraries, that, can be found in many places over internet.
    And beware, with the builtins's some functions are not portable, you must be aware between compiler implementors or platforms, so, if portability is a must for you, I would rather seek for a portable library that gives me the functionality I need.


    -----------------
    http://www.uberum.com

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Include GTK+ just for a data structure?
    By Jesdisciple in forum C Programming
    Replies: 0
    Last Post: 04-12-2009, 07:19 PM
  2. pthread question how would I init this data structure?
    By mr_coffee in forum C Programming
    Replies: 2
    Last Post: 02-23-2009, 12:42 PM
  3. Data structure implementation
    By fkheng in forum C Programming
    Replies: 3
    Last Post: 07-31-2003, 07:44 AM
  4. can't insert data into my B-Tree class structure
    By daluu in forum C++ Programming
    Replies: 0
    Last Post: 12-05-2002, 06:03 PM
  5. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM