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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 06:48:04  来源:igfitidea点击:

C data structure library

cdata-structures

提问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?

是否有任何具有通用数据结构的开源 C 库?

And here is CCAN, C's equivalent to CPAN:

这是 CCAN,C 相当于 CPAN:

http://ccan.ozlabs.org/

http://ccan.ozlabs.org/

回答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);
}

回答by kidjan

If you can fudge it a bit and use C++, Qtis a really great library with a lot of basic data structures.

如果您可以稍微捏一下它并使用 C++,Qt是一个非常棒的库,具有许多基本数据结构。