Tuesday, April 21, 2009

C++: Increasing void pointer position

I've becoming better friends with c++ today. I don't think this relationship is going anywhere.

Managed to crack this little stupid nut though. If you have a void pointer (dynamic array) you can increase it as follows:
void* ptr;            // Say of type char
(*(char*)ptr) += 100; // Or any integer

0 comments: