Circular queue using array

in this for the push operation we are doing (rear=rear+1)%n for pushing the data and rear was at the end of the array initially but for pushing we could have also made a temp ptr which would have been initially equal to front ptr and for pushing we could have moved temp until it reaches rear ptr.
isse hum easliy front and rear elemnts ko bhi direct access kar lete?

if you make a temp pointer and increment it till it reaches rear pointer then in that case you wouldn’t need rear ptr you could have just incremented till it reaches arr.size, also you to consider the fact that array is a circular array so you have to take mod too which makes it same as rear pointer

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.