i have made the following code...
but i am having problems in accessing it..
//structure for queue
struct queue{
int items[MAX];
int front;
int rear;
};
//decleration of the queues :que_term for the values printed on the terminal
struct queue que_mul2,que_mul3,que_mul5,que_sort,que_write,que_term;
//initializing the queue
void InitQueue(queue &q)
{
q.front=0;
q.rear=0;
}
//checking if queue is empty
int isempty(queue &q)
{
if(q.rear==q.front && q.front!=0)
return 1;
else
return 0;
}
//adding an element at the rear of the queue
void join(queue &q,int elem)
{
q.items[q.rear]=elem;
q.rear++;
}
//removing an element from the front of the queue
int leave(queue &q)
{
int elem;
elem=q.items[q.front];
q.front++;
return elem;
// }
// else
// return -1;
}
these are the functions used but when i am calling this function as
join(que_write,1);
then que_write is not getting updated...
i have declared que_write as
struct queue que_write;
as mentioned above
pls tell me where im going wrong?
n is the struct type passed by reference by default like arrays?