Enqueue Operation in a Queue
📖 Scenario: Imagine a line at a ticket counter where people join at the end of the line. This line is called a queue. We will create a queue using an array and add people (numbers) to the end of this queue.
🎯 Goal: You will build a simple queue using an array and write the code to add (enqueue) elements to the queue.
📋 What You'll Learn
Create an integer array called
queue with size 5Create an integer variable called
rear initialized to -1Write a function called
enqueue that adds an integer to the queue if there is spacePrint the queue elements after adding new elements
💡 Why This Matters
🌍 Real World
Queues are used in real life for lines, like waiting for a bus or at a bank. In computers, queues help manage tasks in order.
💼 Career
Understanding queues is important for software jobs that involve task scheduling, resource management, and data processing.
Progress0 / 4 steps
