Ask your own question, for FREE!
Computer Science 9 Online
OpenStudy (anonymous):

i wanted to know about the implementation of queue using linked list.....

OpenStudy (anonymous):

Any specific questions or you just want to know how to do it?

OpenStudy (anonymous):

Here is a pretty straightforward explanation with example on C: http://www.cs.bu.edu/teaching/c/queue/linked-list/types.html

OpenStudy (anonymous):

i have written a code on it could u plz find a mistake on that code it not giving output

OpenStudy (anonymous):

sure, can you share the code?

OpenStudy (anonymous):

this is the code @c0decracker

OpenStudy (anonymous):

i made this on dev c++

OpenStudy (anonymous):

In the constructor for the queue you have this: ``` queue() { front=new_node; front->set_next(NULL); rear = NULL; size=0; } ``` What do you think happens when you do `front=new_node` ? new_node is just a pointer that hasn't been initialized at this point from what I understand, right?

OpenStudy (anonymous):

yes

OpenStudy (anonymous):

actually i wanted to do the coding of such kind of logic i am bit weak in pointers... @c0decracker

OpenStudy (anonymous):

Ok so you do need to initialize that pointer before you use it, cause otherwise it points to a random block of memory. That's an issue. Otherwise, I'll take a deeper look at this code tonight and get back to you with some thoughts.

OpenStudy (anonymous):

okay thanks @c0decracker

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!