-
GetSize
Hello
I am a beginner in C. I have a problem in writing the GetSize in C. Can anyone give me some hints?
I have the following parameters.
int getSize (Queue* the Queue)
the function returns the number of data currently in the queue.
How to write this or is there any reference area that I can refer?
Thanks
-
The Artful Lurker
Shirley,
Divide the size of the entire queue by the size of one element on the queue. That will tell you how many elements are in the queue.
Hope that helps,
-
Im a Capricorn
Hi there,
maybe I am deviating from ur query but i have a slightly better Idea (I guess). Instead of using functions for getting the number of elements in ur Queue, just declare a global variable, say qsize or something, and initialize it to 0 in the beginning and when ever u add or delete elements to the queue, increment or decrement it accordingly.
Good Luck,
Best Wishes,
Sriharsha.
Help everyone you can
Popular pages
Recent additions