Hi,
I had to make a queue structure using linked list. (code below)
My next task is to change it, to have empty node in front and in the end of the queue.
I'm not shure how this structure should works, I'm not able to find this type of queue anywhere.
Could you please help me to unerstand how it should work.
You shouldn't use an InitQueue() function. It requires that the Queue be placed on the heap, which means you have to delete it (something that can be forgotten). And you should initialize the member variables rather than using memset.
So use a constructor instead. I've also added a constructor for QueueItem:
Well tell your professor that Dave on cplusplus.com says he's an idiot. :) Hmm. On second thought, maybe he's using this as a way to show the motivation for constructors.
Is this class for C or C++? The fact that you're using structs and Init functions and malloc() and memset() sounds like it's C to me.
If he/she insists on an init function then I'd model it after a constructor anyway. You can create first and last nodes as follows: