C语言 C数据结构库
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4016383/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
C data structure library
提问by code2b
I want to use a stack in C, anybody recommend a library?
我想在 C 中使用堆栈,有人推荐一个库吗?
For example for a hash table I used UThash.
例如,对于哈希表,我使用了 UThash。
Thanks!
谢谢!
采纳答案by Noah Watkins
Here is a similar question:
这是一个类似的问题:
Are there any open source C libraries with common data structures?
And here is CCAN, C's equivalent to CPAN:
这是 CCAN,C 相当于 CPAN:
回答by Vovanium
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);
}

