I am trying to use #define to define a constant in my program. I realize I could use const, but I am trying to get a good understanding of #define. Could someone please explain why the following code does not work, and should be done instead?
#include <stdio.h>
#define M 20;
typedef int Marray_t[M][M]; //I can't define an M x M array
int main() {
Marray_t A;
int i;
for (i = 0; i < M; ++i) { //Can't iterate up to M
A[i] = i;
}
return 0;
}