#include <acknex.h>
int INT_CalculeIndex ( int IndexX, int IndexY )
{
return ( (IndexX*8)+IndexY );
}
function main ()
{
wait(3);
STRING *stemp = str_create ( "" );
int IndexY, IndexX, CalculatedIndex;
char CHR_Array[8][8];
char *CHR_Pointer;
CHR_Pointer = CHR_Array;
for ( IndexX=0; IndexX<8; IndexX++ )
{
for ( IndexY=0; IndexY<8; IndexY++ )
{
CalculatedIndex = INT_CalculeIndex ( IndexX, IndexY );
// I can assign values to the array with its dimensions
CHR_Array[IndexX][IndexY] = CalculatedIndex;
// also calculating a unique index
CHR_Array[CalculatedIndex] = CalculatedIndex;
// I can assign values to the array using the pointer and calculating a unique index
CHR_Pointer[CalculatedIndex] = CalculatedIndex;
// but not using the array dimensions, compiler returns a dimension of array error
//CHR_Pointer[IndexX][IndexY] = CalculatedIndex;
}
}
while ( !key_esc )
{
for ( IndexX=0; IndexX<8; IndexX++ )
{
for ( IndexY=0; IndexY<8; IndexY++ )
{
CalculatedIndex = INT_CalculeIndex ( IndexX, IndexY );
draw_text ( str_for_int(NULL,CHR_Array[CalculatedIndex]), IndexX*30, IndexY*30, COLOR_WHITE );
draw_text ( str_for_int(NULL,CHR_Pointer[CalculatedIndex]), 300+(IndexX*30), IndexY*30, COLOR_WHITE );
draw_text ( str_for_int(NULL,CHR_Array[IndexX][IndexY]), IndexX*30, 300+(IndexY*30), COLOR_WHITE );
// same compiler dimension of array error
//draw_text ( str_for_int(NULL,CHR_Array[IndexX][IndexY]), 300+(IndexX*30), 300+(IndexY*30), COLOR_WHITE );
}
}
wait(1);
}
sys_exit ( NULL );
}