Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
// This is the helper macro
#define index(x,y) (((x)*y_size) + (y))
// reserve some memory for 1-dimensional array.
int array[128];
// we also need helper variables that define the array dimensions.
char x_size = 16;
char y_size = 5;
// using a macro to access this as 2-dimensional array.
array[index(15,3)] = something;
// reserve some memory
unsigned char memory_pool[256]
int used_mem = 0;
// Pointer for mimiced 2-dimensional array
int *array1;
// Pointer for 1-dimensional array
char *array2;
// Get a chunk of that memory.. 2-dimensional 16*5 integer array
array1 = (int*)(&memory_pool[used_mem]);
used_mem += 16*5*sizeof(int); // simple memory book keeping
// Lets get another chunk.. 1-dimensional array with 128 elements
array2 = (char*)(&memory_pool[used_mem]);
used_mem += 128*sizeof(char);
// you can calculate how much memory you have left like this
int memory_left;
memory_left = sizeof(memory_pool) - used_mem;