Try two nested for loops, like
for (condition relating to [x][])
// then
for (condition relating to second dimension [][x])
So you end up with
[0][0] to [0][9] (or whatever) then you come out of the inner for loop. Then
control goes to the outer loop and then goes back into the second to do
[1][0] to [1][9]
>From: Piotrus Student <pio...@wp...>
>Reply-To: Piotrus Student <pio...@wp...>
>To: dev...@li...
>Subject: [Dev-C++] two-dimensional arrays
>Date: Sun, 27 Apr 2003 01:40:40 +0200
>
>Hello
>
>Could somebody help me to solve the following problem?
>I have to swap two two-dimensional arrays. I wouldn't like to do it in
>this way:
>
>...
>double vec_1[N][M],vec_2[N][M],temp;
>int i,j;
>...
>for(i=0;i<N;i++)
> for(j=0;j<M;j++)
> {
> temp=vec_1[i][j];
> vec_1[i][j]=vec_2[i][j];
> vec_2[i][j]=temp;
> }
>...
>
>
>Thanks for advance. Peter.
>
>
>
>
>-------------------------------------------------------
>This sf.net email is sponsored by:ThinkGeek
>Welcome to geek heaven.
>http://thinkgeek.com/sf
>_______________________________________________
>Dev-cpp-users mailing list
>Dev...@li...
>TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm
>https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
_________________________________________________________________
Overloaded with spam? With MSN 8, you can filter it out
http://join.msn.com/?page=features/junkmail&pgmarket=en-gb&XAPID=32&DI=1059
|