The code is not working pls tell why?

@jsn853
Firstly I would request you to ask your doubts to the related topics only. You have asked a doubt related to trees on a problem related to arrays. It creates confusion on our side as TAs.

Coming to your problem , change your queue popping statements to this

p = q.front();
q.pop();

q.pop() has a void return type. To extract the front of the queue , you must use the front() function first.

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.

Can u pls tell the topic in which u have doubt as i got ur doubt in a question different from the solution u have provided

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.