Mega Code Archive

 
Categories / C / Macro Preprocessor
 

Define constant in Macro

#include <stdio.h> #include <assert.h> #define ROW_Constant 10 #define COL_Constant 10 int main() {   int row, col;   for ( row = 1; row <= ROW_Constant; row++) {       assert ( row <= ROW_Constant );       for ( col = 1; col <= COL_Constant; col++ ) {           assert ( col <= COL_Constant );           printf ( "%4d", row * col );       }       printf ( "\n" );   } }