Queue queue = createQueue(); //queue to store int values
Node *node = getNode(8);
enQueue(queue, (int)node);//storing an address in the int
..... some other statements ....
Node *root = (Node *) deQueue(queue);//typecasting an int to address
Node *left = root->left;
In the above code, queue can store integer values while address is being stored assigned in it.can it create any problem?
what are the situations or any architecture where storing address in an int can be problematic?
please give some examples.
The architecture where pointers are larger than an
int. That is, most 64-bit systems. You can use the typelongor betterintptr_t.