How I can implement Swap Arays function??

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Oct 2008
Posts: 11
Reputation: Boudou has a little shameless behaviour in the past 
Solved Threads: 0
Boudou Boudou is offline Offline
Newbie Poster

How I can implement Swap Arays function??

 
0
  #1
Oct 26th, 2008
  1. #include <stdio.h>
  2. #define SIZE 3
  3. void swaparrays(int* a, int* b);
  4. main ()
  5. {
  6. int a[3][3]={{0, 2, 3},
  7. {1, 5, 7},
  8. {3, 9, 4}};
  9.  
  10. int b[3][3]={{2, 8, 5},
  11. {4, 7, 1},
  12. {3, 9, 2}};
  13. }
  14.  
  15. void swaparrays(int* , int* );
  16. {
  17. //How I can impement swap arrays Function???//
  18. }
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 25
Reputation: uim_1977 is an unknown quantity at this point 
Solved Threads: 0
uim_1977 uim_1977 is offline Offline
Light Poster

Re: How I can implement Swap Arays function??

 
0
  #2
Oct 26th, 2008
  1.  
  2. void swaparrays(int* a, int* b);
  3. {
  4. int temp;
  5. for (int i =1 , i=3, i++)
  6. {
  7. for (int j=1, j=2, j++)
  8. {
  9. temp = a[i][j];
  10. a[i][j]=b[i][j];
  11. b[i][j]=temp;
  12. }
  13. }
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 25
Reputation: uim_1977 is an unknown quantity at this point 
Solved Threads: 0
uim_1977 uim_1977 is offline Offline
Light Poster

Re: How I can implement Swap Arays function??

 
0
  #3
Oct 26th, 2008
void swaparrays(int* a, int* b);
{
int temp;
for (int i =1 , i=3, i++)
{
for (int j=1, j=2, j++)
{
temp = a[i][j];
a[i][j]=b[i][j];
b[i][j]=temp;
}
}

I'm sorry here is a mestake
for (int i=1, i<=3, i++)
and
foe (int j=1, j<=3, j++)
also even better to use defined earlier in programm SIZE for condition of the for loop
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC