declaration of 2 dimensional array having different type (one column float, anothe int)

Is there any way to declare 2 dim array that one column data type is int and the other is float in one line without using structure?

You can't mix fundamental types with each other. Maybe some void pointer could be of use, though that would require some ugly casting.

Why do you need such array? I bet there is better solution for your problem.

edit: you could always create float array and cast to int some column values, though that would still need casting everytime
Last edited on
then The only way is using structure definition?
Last edited on
take a look at boost's variant structure. not really that nice though.
http://www.boost.org/doc/libs/1_54_0/doc/html/variant.html

cant you just have both as floats?
then The only way is using structure definition?

There are other ways to get around it, but they're ugly and unintuitive. Structures are certainly a better way of doing it.

Don't be scared of learning how to use them! Once you understand them, you'll find them very useful :)
Topic archived. No new replies allowed.