From 4bb56d11afb3c7f74135db530161a2cbc01dfc3a Mon Sep 17 00:00:00 2001 From: Rushin Shah Date: Sat, 4 May 2024 17:29:08 +0530 Subject: [PATCH] fixed the bug #2690 in data_structures/queue_using_array2.cpp --- data_structures/queue_using_array2.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/data_structures/queue_using_array2.cpp b/data_structures/queue_using_array2.cpp index 13f7d8e17f8..8fdc2e0a414 100644 --- a/data_structures/queue_using_array2.cpp +++ b/data_structures/queue_using_array2.cpp @@ -1,7 +1,7 @@ #include using namespace std; -int queue[10]; +int arr[10]; int front = 0; int rear = 0; @@ -9,7 +9,7 @@ void Enque(int x) { if (rear == 10) { cout << "\nOverflow"; } else { - queue[rear++] = x; + arr[rear++] = x; } } @@ -19,9 +19,9 @@ void Deque() { } else { - cout << "\n" << queue[front++] << " deleted"; + cout << "\n" << arr[front++] << " deleted"; for (int i = front; i < rear; i++) { - queue[i - front] = queue[i]; + arr[i - front] = arr[i]; } rear = rear - front; front = 0; @@ -30,7 +30,7 @@ void Deque() { void show() { for (int i = front; i < rear; i++) { - cout << queue[i] << "\t"; + cout << arr[i] << "\t"; } }