i wanted to know about the implementation of queue using linked list.....
Any specific questions or you just want to know how to do it?
Here is a pretty straightforward explanation with example on C: http://www.cs.bu.edu/teaching/c/queue/linked-list/types.html
i have written a code on it could u plz find a mistake on that code it not giving output
sure, can you share the code?
this is the code @c0decracker
i made this on dev c++
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?
yes
actually i wanted to do the coding of such kind of logic i am bit weak in pointers... @c0decracker
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.
okay thanks @c0decracker
Join our real-time social learning platform and learn together with your friends!