+ 2
Queue operations in c
In this code when I enter 2 and then 4 as operations,I should get "QUEUE:empty" as output but I am getting "QUEUE:4" https://code.sololearn.com/cmn2791CcY93/?ref=app
2 Réponses
+ 9
Pretty sure line 87:
if((front && rear)==-1)
should be
if(front==-1 && rear==-1)
+ 2
actually it should be if((front==-1 && rear==-1) || (front > rear))
You have to compare front and rear each time because you don't reset them immediately after front + 1.