Our new Indie Games subforum is now open for business in G&T. Go and check it out, you might land a code for a free game. If you're developing an indie game and want to post about it, follow these directions. If you don't, he'll break your legs! Hahaha! Seriously though.
Our rules have been updated and given their own forum. Go and look at them! They are nice, and there may be new ones that you didn't know about! Hooray for rules! Hooray for The System! Hooray for Conforming!
C++ problem (I need to get a pointer to an array of ints out of a *void)
An array is really just a pointer to some contiguous memory. A void* is a generic pointer, it can point to any type. You just need to cast it back to something useful. The following should work.
int* arrayPointer = (int*)voidPointerVariable;
Then you can use arrayPointer like you would any array.
An array is really just a pointer to some contiguous memory. A void* is a generic pointer, it can point to any type. You just need to cast it back to something useful. The following should work.
int* arrayPointer = (int*)voidPointerVariable;
Then you can use arrayPointer like you would any array.
arrayPointer[0], arrayPointer[1], etc.
Perfect - as you can tell, I am not knowledgeable with pointers - thank you very much.
Posts
int* arrayPointer = (int*)voidPointerVariable;
Then you can use arrayPointer like you would any array.
arrayPointer[0], arrayPointer[1], etc.
Perfect - as you can tell, I am not knowledgeable with pointers