Using:
int main(void)
{
int a =1, b=2, c=3;
struct queueStruct queue = {0};
que_insert( &queue, &a);
que_insert( &queue, &b);
que_insert( &queue, &c);
}
I get:
> ./q
1 1
1 2
1 3
Seems that it works to me. Than again, you didn't post your driver code. If you are doing something like:
int main(void)
{
int a=1;
struct queueStruct queue = {0};
que_insert( &queue, &a);
a=2;
que_insert( &queue, &a);
}
Then it will always be the same, because both nodes point to the same address in memory, so when you change a to 2, both node's pointers point to the same memory and therefore are changed at the same time. Most likely, this is your real problem.