我是編程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;
}
感謝您的幫助。
非常感謝。這對我幫助很大。 – wit4r7