#include <acknex.h>
#include <default.c>
//
//
//---------------------------------------------------------------------------------------
//
//
void main()
{
wait(1); level_load(NULL); wait(1); diag("\n\n\n");
draw_textmode("Courier",0,25,100); warn_level = 3; on_esc = NULL;
VECTOR col; vec_fill(col, 255); var idx;
//------------------------------------------------------------------------------------
//
//
short *row_1 = (short*)sys_malloc(sizeof(short)*20);
short *row_2 = (short*)sys_malloc(sizeof(short)*20);
//
//////////////////////////////////////////////////////////////////////////////////////
// THIS IS THE AREA TO WATCH //// only un-comment one line at a time ///////////////
//
short *point1, *point2, *dummy=sys_malloc(sizeof(short)); //both work
// short *point1, *dummy=sys_malloc(sizeof(short)), *point2; //only row_2 fails
// short *dummy=sys_malloc(sizeof(short)), *point1, *point2; //both fail
// now watch this NEW discovery!!
// short *dummy=sys_malloc(250), *point1, *point2; //both WORK if size_of function not used
//
//////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////
//
point1 = &row_1[5]; point2 = &row_2[5];
//
while(!key_esc)
{
memset(row_1, 0, sizeof(short)*20); memset(row_2, 0, sizeof(short)*20);
//
//------------------------------------------------------------------------------------
if(key_1) { for(idx=0; idx<9; idx++) row_1[idx+5] = idx+1; }
if(key_2) { for(idx=0; idx<9; idx++) row_2[idx+5] = idx+1; }
//
if(key_5) { for(idx=0; idx<9; idx++) point1[idx] = idx+1; }
if(key_6) { for(idx=0; idx<9; idx++) point2[idx] = idx+1; }
//------------------------------------------------------------------------------------
//
draw_text("Array 0.1.2.3.4.5.6.7.8.9.0.1.2.3.4.5.6.7.8.9.", 100, 100, col);
draw_text("Row_1", 100, 130, col); draw_text("Row_2", 100, 160, col);
for(idx=0; idx<20; idx++)
{ draw_text(str_for_int(NULL, row_1[idx]), 184+(idx*24), 130, col);
draw_text(str_for_int(NULL, row_2[idx]), 184+(idx*24), 160, col); }
//
draw_text("Hold the '1' key to fill row_1 directly via 'row_1[x]'", 100, 300, col);
draw_text("Hold the '2' key to fill row_2 directly via 'row_2[x]'", 100, 340, col);
draw_text("Hold the '5' key to fill row_1 via pointer 'point1[x]'", 100, 380, col);
draw_text("Hold the '6' key to fill row_2 via pointer 'point2[x]'", 100, 420, col);
//
wait(1);
}
//
//
//
//------------------------------------------------------------------------------------
if(key_shift) exec("notepad.exe", "acklog.txt");
sys_exit(0);
}