Re: A89: Matrix Errors


Re: A89: Matrix Errors

At 21:04 2001-02-11, you wrote:
>int lvl=1;
>int **hp = new int[lvl][2];

ehm.. new is a C++ construction...
And that is not his problem anyway, that line he doesn't want a new array, 
he just want an int with the value of stats[1][2]
The problem is that you cant initialize a new variable in C like he is 
trying in that code.
change to:

int hp,mhp,mp,mmp;
hp = stats[lvl][2];
mhp = stats[lvl][2];

and so on, instead.

>>I am having trouble using matrices.  If I declare a matrix and then try to
>>reference it the compiler gives me an error "Initializer value is not a
>>constant."  Heres the code:
>>int stats[6][8]=
>>int lvl=1;
>>int hp=stats[lvl][2],mhp=stats[lvl][2],mp=stats[lvl][3],mmp=stats[lvl][3];
>>                        /\
>>                        | |
>>the error points to here
>>and one more thing, this code is outside of all of my functions so it is
>>global, if that matters.  Can someone help me please?