how do i find the number of items in a circular queue?
|front - rear| doesnt always work.
is there one equation to know how many element is in a cir
None of the formulas take into account the empty (zero) case. This will give you the number of free bytes available in the queue:
FreeSpace = (printRdQue == printWrQue) ? PRINT_QUEUE_SIZE : (PRINT_QUEUE_SIZE - printWrQue + printRdQue) % PRINT_QUEUE_SIZE;