Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C data structure library [closed]

I want to use a stack in C, anybody recommend a library?

For example for a hash table I used UThash.

Thanks!

like image 743
code2b Avatar asked Oct 25 '10 15:10

code2b


People also ask

Does C have built in data structure?

The C Programming language has many data structures like an array, stack, queue, linked list, tree, etc. A programmer selects an appropriate data structure and uses it according to their convenience.

Is there a library for stack in C?

The pop and return external functions are provided with the argument stack library. The pop external functions are described below according to the data type of the value that each pops from the argument stack. The return external functions are described in Return functions for C.

Does C have a queue library?

C is not an object-oriented language, and it doesn't have standard libraries for things like queues.

Why is there no STL for C?

C can't have an "exact equivalent" of STL because C doesn't have templates or classes.


1 Answers

Stack implementation fits in single sheet of paper.

That's simplest stack example

int stack[1000];

int *sp;

#define push(sp, n) (*((sp)++) = (n))
#define pop(sp) (*--(sp))
...
{
    sp = stack; /* initialize */

    push(sp, 10);
    x = pop(sp);
}
like image 185
Vovanium Avatar answered Sep 28 '22 17:09

Vovanium