Originally Posted by
rinky05
no i don't need a data element in the structure, i know that prev will point to previous element and next to the next element...just wanted to know what will be values of q_next and q_prev in the condition mentioned in the problem...]
thanks in advance!!
'devices' is a struct of type queue_t, you assign it's own address to the two members *q_next and *q_prev. I guess this is the inital state of your queue, where it's self referential.
Try adding this after the line that confuses you:
Code:
printf("%p %p %p\n", &devices, devices.q_next, devices.q_prev);
This doesn't mean that you won't need a data element in the struct however, although it's possible to create without one it's pointless since you can not add anything to your queue.