-
Create a defined constant to allow us to set the size of a game board to 8 units. Show how it would be used.
-
Explain what the following C would display on the LCD panel:
#define FRENCH
#ifdef FRENCH
lcd_print ( "Bonjour" ) ;
#endif
#ifdef ENGLISH
lcd_print ( "Hello" ) ;
#endif
Answers
-
#define MAX_BOARD 8
int board[MAX_BOARD] [MAX_BOARD];
for ( i = 0 ; i < MAX_BOARD ; i++ ) { ... }
-
As FRENCH is defined, the LCD will print 'Bonjour'. You can this kind of mechanism to make programs that can be compiled for a range of languages.