12 years, 5 months ago.

what about #define?

to make my code easier to read i made:


#define rood 0;
#define groen 1;
#define blauw 2;
#define clear 3;

colorData[rood] = lees2register(INT_RED_LO);
colorData[groen] = lees2register(INT_GREEN_LO);
colorData[blauw] = lees2register(INT_BLUE_LO);
colorData[clear] = lees2register(INT_CLEAR_LO);


if i leave it like this, i get messages: expected a [ at the place where rood, groen, blauw, clear are. if i change these with 0, 1, 2, 3 i dont get those fault messages, what do i have to change so i can leave the rood, groen... so my code is easier to read?? thanks in advance

1 Answer

12 years, 5 months ago.

Remove the ';' after your numbers, define replaces for example 'rood' with '0;' now.

Accepted Answer