I just learned double pointer. Whenever you have a problem:
You have a pointer to address 0x000005. Let's say void*p points to address 0x000005. That address has value 0x000003. That value is actually the pointer to address 0x000003. You can use double pointer in this case.
Firstly, you get the value of that address, then you convert that value into pointer that points to another address.
For example:
You want to access address 0x000003. You don't have any pointer to it. But you only have void *x points to address 0x000005 and that address is a pointer to 0x000005.
The solution is using double pointer.
void **p = (void**) x;
void* z = *p;
Now z is a pointer to address 0x000003.
No comments:
Post a Comment