On Thu, Jan 8, 2009 at 11:30 AM, John Matthews <[email protected]> wrote:
> --- In [email protected], Christopher Coale <chris95...@...> wrote:
>>
>> Jos Timanta Tarigan wrote:
>> >
>> > colour *col=new colour[10][10]; <-- i cant compile this line.
>> >
>> > cannot convert int(*)[10] to int*
>> >
>> You just need to typecast the "new colour[10][10]" to a "colour *".
>>
>> colour *col = (colour *)new colour[10][10];
>
> Sorry, I don't do C++, but if you needed a typecast in the equivalent
> C program, I would say you had done something wrong. Please tell me
> there's a better way :-)

Personally, even in C, if I had a complex array like that to pass
around, I'd go for a  more object-oriented approach and wrap it with a
struct, so you could store lengths of dimensions, etc. In C++, you
have even more options (and I would use a container class instead of
raw arrays).

-- Brett
------------------------------------------------------------
"In the rhythm of music a secret is hidden;
    If I were to divulge it, it would overturn the world."
               -- Jelaleddin Rumi

Reply via email to