if R is my rows number and C my column number I initialize a pointer like this:
int * a = (int*) malloc(R*C*sizeof(int));
Then to access the second element in the second row I type:
a[1*c + 1]
I want to emulate a 2D arr.
How can I make a macro that will convert this: a[i][j] to this a[i*c + j]?
#define a(i,j) a[(i)*c+(j)]but I don't think it will be useful using the original one is much more safer and readablea(1+3, 4)