A queue is an ordered list, which can be implemented as an array or a linked list.
Follow the first-in, first-out rule, that is, data that enters the queue first must be taken out first. What you deposit later must be taken out later.
Array simulation queue
As shown below
Because the output and input of the queue are processed respectively from the front and back ends, two variables front and rear are required to record the subscripts of the front and back ends of the queue respectively. The front will change with data output, and the rear will change with data input.
The fatal problem is that when rear=maxSize-1, no matter where the front is, the program will remind "the queue is full"