R
Ramon
Hi,
How can I change the address of a pointer? Please look at the code
below. What I'm trying to do is to make c = &cell (without using this
notation of course). How can I assign the address of /cell/ (which is
stored in the variable /addr/) to the pointer named /c/??
// cell is a struct
Cell *cell = (Cell *) malloc(sizeof(Cell));
// getting the address of the mem location of the object
unsigned int addr = (unsigned int) &cell;
// changing the address of the new pointer to point to the
// 'cell' object
Cell *c = ??? <-- make c point to the address addr
Thanks.
How can I change the address of a pointer? Please look at the code
below. What I'm trying to do is to make c = &cell (without using this
notation of course). How can I assign the address of /cell/ (which is
stored in the variable /addr/) to the pointer named /c/??
// cell is a struct
Cell *cell = (Cell *) malloc(sizeof(Cell));
// getting the address of the mem location of the object
unsigned int addr = (unsigned int) &cell;
// changing the address of the new pointer to point to the
// 'cell' object
Cell *c = ??? <-- make c point to the address addr
Thanks.