Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

dequeue function in c++

danitdanit Member Posts: 2
i am writing code for queue which uses linked list data structure for its implementation, in which node class has two data member(for instance node has name and number in its private section) , i am having problem to write function for get() in dequeue(delete node having two data members and move front pointer ahead) as there are two data members,
first i wrote:

int dequeue()
{
int x = front->get() ;
node *p = front ;
front = front->getnext() ;
delete p;
size--;
return x ;
}
then i wrote:
int dequeue()
{
int x = front->getname() ;
node *w =front->getage() ;
node *p = front ;
front = front->getnext() ;
delete p ;
delete w ;
size--;
return x ;
}
both are not working ,i need some advise.
(clarification will be provided if needed)

Comments

Sign In or Register to comment.