Hi guys,
What do you think about "flattening the array"? Is this legal? For example:
int matrix[6][10];
int *mp;
.....(some code goes here)
mp = &matrix[3][8]; /* so mp points to 3rd row and 8th column */
printf( "First element is %d\n",*mp);/* we are at [3][8]*/
printf( "Second element is %d\n",*++mp);/* next one [3][9]*/
printf( "Third element is %d\n",*++mp);/* [4][0] */
Just read that this technique ia illegal and should be avoided.I don' t quite understand why.After all...aren't multi-dimensional array are really single-dimensional arrays?