while browsing through a queue examples, I came across
http://login2win.blogspot.in/2008/07/c-queues.html
Its a queue example in which the indexes start from -1, but the program seems to be working fine
Is this valid, shouldn't this be a undefined behavior in some cases?
rear = ++rear % MAX_SIZE;which is also UB. Please don't use that code at all!