Answer can be both....if p points to rear then answer is already given
Now the case if p points to front:
Enqueue:
1.save the data of the node pointed by p in a temp variable.
2.copy the data of new node to the node p is pointing to.
3.copy the data of the temp variable to the new node created
4.make newnode->next=p->next point to the new node
5.make p->next=newnode
6.make p=p->next
Dequeue:
1.copy the data of the node in p->next to p.
2.make p->next=p->next->next