for ( j = 0; j < d1; j++ ){
m += j;
for ( i = 0; i < d1*d2; i +=d2){
cout << *(m+i);
}
cout << endl;
}
d1,d2 are array dimensions
and
int* m = new int [d1*d2];
I want to traverse over my array and simply group and print the columns.Can't figure what's wrong with this code.Seems to be working fine untill the 3rd iteration in the following example:
Let's say my input values are 1 2 3 4 5 6 7 8 9
I get:
1 4 7
2 5 8
4 7 (something random)