我有一个文件queue.c,用C语言定义一个队列.我如何使3个独立的队列相互独立?我对C不是很有经验,我在OO视图中一直在思考它,我知道我不能这样做.
#include <stdio.h> #include <stdlib.h> struct Node { char data; struct Node *next; } *Head,*Tail; void addCharacter(char c) { struct Node *temp1,*temp2; temp1 = (struct Node *)malloc(sizeof(struct Node)); temp1->data = c; temp2 = Tail; if(Head == NULL) { Head = temp1; Head->next = NULL; Tail = Head; } else { Tail = temp1; temp1->next = NULL; temp2->next = temp1; } } void deleteCharacter() { struct Node *temp1 = Head; Head = temp1->next; free(temp1); } int replaceCharacter(char c) { Head->data = c; } int main() {}
#include "queue.h"
我不知道从哪里去…