【发布时间】:2017-05-07 08:42:04
【问题描述】:
我是 C 编程新手。我尝试编写很多程序以变得更好 :) 但此刻我陷入了一个愚蠢的境地。
我有一个任务是创建一个优先级队列。我一开始就得到了这两个结构。
struct q_elem_s {
char* name;
int priority;
struct q_elem_s *next;
};
struct PrioQueue {
int size; //size of the queue
q_elem *root; //Beginn of the queue
};
通常我对队列没有问题,但我对第二个结构感到困惑。
所以我的想法:
PrioQueue* pqueue_new() {
q_elem = malloc(sizeof(q_elem_s));
return NULL;
}
感谢您的帮助。
【问题讨论】: