Dear all, is there is a way to go trough a matrix using just one "for" loop?, I mean I have this snippet:
#define WIDTH 5
#define HEIGHT 3
int mat [HEIGHT * WIDTH];
int n,m;
int main ()
{
for (n=0;n<HEIGHT;n++)
for (m=0;m<WIDTH;m++)
{
mat[n*WIDTH+m]=(n+1)*(m+1);
}
return 0;
}
But I was wondering if it is possible to go trough that pseudo-multidimensional array with one "for" loop. Actually I think that if the matrix is a square matrix may be is possible. Is it possible to
Any help would be appreciated, Thank you very much in advanced.