Question: Please explain the codes in each line. queue lab, c lang /* Return number of elements in queue. Return 0 if q is NULL or
Please explain the codes in each line. queue lab, c lang /*
Return number of elements in queue.
Return 0 if q is NULL or empty
*/
int q_size(queue_t *q)
{ /* You need to write the code for this function */
/* Remember: It should operate in O(1) time */
if(q != NULL) // ???
return q->n; // ????
return 0; // ???
}
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
