Курсовая работа: Списки стеки очереди в C
value = (*headPtr)->data;
tempPtr = *headPtr;
*headPtr = (*headPtr)->nextPtr;
if (*headPtr == NULL) *tailPtr = NULL;
free(tempPtr); return value; }
int isEmpty(QUEUENODEPTR headPtr) {
return headPtr == NULL; }
void printQueue(QUEUENODEPTR currentPtr) {
if (currentPtr == NULL)
printf("Queue is empty.\n\n"); else {
printf("The queue is :\n");
while (currentPtr != NULL) {
cout<< currentPtr->data<<"-->";
currentPtr = currentPtr->nextPtr; }
printf("NULL\n\n"); }
}
При виконанні програми можливі результати:
Enter your choice:
1 to add an item to the queue
2 to remove an item from the queue
3 to end ? 1
Enter a character: A
The queue is:
A --> NULL
? 1
Enter a character: В
The queue is:
A --> В --> NULL
? 1