Array/Vector Multitype

I'm trying to make a virtual machine thing, and I have run into a problem. Unless I want massive amounts of useless data, I'm going to need a way to store multiple data types in one array. If this is not possible, I suppose it would be possible to have some sort of address tracker, though making it like this and having a separate array/vector saying what to interpret it as would be much simpler. The obvious way to do this is to use binary as real computers do, though that complicates it so much more.

Alternatively, if any of you come up with another way of doing this, please tell me :D

Thanks
Have you tried structures?

If I am correct they are capable to 'storing' multiple variable types. I know there is a better explanation somewhere on this site...

*browses site for a moment*

Here it is: http://www.cplusplus.com/doc/tutorial/structures/

I hope these will help!
I've had a bit of a look, and I don't see how I would use that. As far as I can see, it only organizes data.
*bump*
As far as I know, there is no way to do this. Even when using pointers, you'll still need to know what type they're pointing at for them to have any meaning.

Structures are used to 'group' data. Rather than having an array of strings for names, ints for ages and short doubles for penis size, you can have an array of structs that each have a string, int and short double. It makes your grouping much more transparent than separate index-linked arrays, especially once sorting/position swaps come into play.

I don't know if that's of any use to you, because you haven't really explained your problem.
Topic archived. No new replies allowed.