Run ❯
Get your
own
website
❯
Run Code
Ctrl+Alt+R
Change Orientation
Ctrl+Alt+O
Change Theme
Ctrl+Alt+D
Go to Spaces
Ctrl+Alt+P
#include
int main() { int queue[5]; int front = 0; // Index of the first item int rear = -1; // Index of the last item // Enqueue 10, 20 and 30 (add at the rear) rear++; queue[rear] = 10; rear++; queue[rear] = 20; rear++; queue[rear] = 30; // Dequeue (remove from the front) printf("Dequeued: %d\n", queue[front]); front++; printf("Front item now: %d\n", queue[front]); return 0; }
Dequeued: 10
Front item now: 20