Help with linked list for displaying "queue is full"
How to show that the queue is full / queue underflow using linked list , i mean what are the basic steps to make the program to display it ?? can anyone help me to put the "stack is full" option under the insert function in this given program?? i wan't to add only that function !! i tried my best but didn't find any proper solution ! any help would mean a lot to me !!
program is given below , i just wan't to add the "queue is full" option !! thanx a lot in advance
program !! Attachment 802
Re: Help with linked list for displaying "queue is full"
Queue full and queue underflow are two different conditions and you cannot check for them both at the same time (well, you could, but there's not a lot of point. There's no need to check if the queue is about to underflow when you add an item, or if the queue is about to overflow when you delete an item).
Linked lists generally only need to run out when memory runs out so a queue full should normally correspond to a check for failure to allocate memory, but the error then should be "not enough memory", not "queue full". However there could be design reasons for your queue being limited in size (but then, why are you using a linked list instead of a simple array?).
Anyway, it's not difficult. Just check if the queue is at maximum size and throw an error when the user tries to add more:
|All times are GMT +5.5. The time now is 11:14.|