typedef struct {
var array_size;
STRING *str[999];
} LIST;
LIST *currency;
void add_to_str(LIST *pointer, STRING *str){
pointer->str[pointer->array_size] = str_create(str);
pointer->array_size++;
}
void test_currency(scancode){
if(!currency){ currency = sys_nxalloc(sizeof(LIST)); }
if(scancode == 2){ add_to_str(currency, "EUR"); }
if(scancode == 3){ add_to_str(currency, "USD"); }
if(scancode == 4){ add_to_str(currency, "AUD"); }
}
void main(){
on_1 = test_currency; // add EUR to list
on_2 = test_currency; // add USD to list
on_3 = test_currency; // add AUD to list
int i = 0;
while(!key_esc){
// if currency exist ?
if(currency){
// show total amount of strings
DEBUG_VAR(currency->array_size, 10);
// cycle through all list and show it's elements
for(i = 0; i < currency->array_size; i++){
draw_text(currency->str[i], 10, 30 + 20 * i, COLOR_WHITE);
}
}
wait(1);
}
}