Priority Queue C
问题 I'm trying to create a priority queue using an array of queues, each index of the array being a priority. I tried the following solution, The queue data type contains an array llist, Queue *q_create(int size) { struct queue *p; struct q_head *h; int i; if ((p = (struct queue *)malloc(sizeof(struct queue))) != NULL) { p->size = size; for (i = 0; i < PRIODIFF; i++) { h = &(p->llist[i]); h->head = NULL; h->tail = NULL; } } return p; } I'm confused by the line: h = &(p->llist[i]); I was thinking