
Untitled
By: a guest on
May 29th, 2012 | syntax:
None | size: 1.05 KB | hits: 9 | expires: Never
One last thing about C pointers: confused about what this snippet of code will do?
void *a = //something;
*((unsigned **)((char*)b+4)) = a;
*((char *)b + 4) = a;
|----------|
| b+4 |
| | 1000
| 2000 |
|----------|
|
|
|
|
-------------------->|----------|
| num |
-------------------->| | 2000
| | 2 | This is what a points to
| |----------|
|
|
|----------|
| a |
| | 3000
| 2000 |
|----------|
int c;
void * a = &c;
unsigned d;
unsigned * e = &d;
unsigned ** b = &e;
b = (unsigned **)&a;