Is this supposed to be C, not C++? I question this because of int isempty(queue &q) -- the parameter looks like a c++ reference.
Is that supposed to be circular queue where the front and back variables wrap around to 0 then the bufferitems is filled up? If yes or no you need to add code to the join() function to wrap the front variable when it reached MAX, or not allow any more items in the queue when (front+1) > rear.
You need to firm up your understanding of the front and back variables.
front: This is where the next item will be inserted into the queue. When an item is inserted (see join function) this is the variable that should get incremented.
rear: This is where the next item will be removed from the queue. When an item is removed from the queue (see leave function) this is the variable that will be incremented.
You need checks in join() that front+1 does not exceed rear. And you need checks in leave() that rear+1 does not exceed front.