Add return value in deque()

This commit is contained in:
stepfencurryxiao 2020-04-21 18:38:03 +08:00
parent 0cf9b4eb45
commit 22a179f2db

View File

@ -66,7 +66,7 @@ void enque(int x) {
* Takes the next item from the Queue. * Takes the next item from the Queue.
*/ */
int deque() { int deque() {
int returnData; int returnData = 0;
if(head == NULL) { if(head == NULL) {
printf("ERROR: Deque from empty queue.\n"); printf("ERROR: Deque from empty queue.\n");
exit(1); exit(1);
@ -78,6 +78,7 @@ int deque() {
head = head->pre; head = head->pre;
head->next = NULL; head->next = NULL;
} }
return returnData;
} }
/** /**