943,749 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 419
  • C++ RSS
Oct 26th, 2008
0

How I can implement Swap Arays function??

Expand Post »
C++ Syntax (Toggle Plain Text)
  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. }
Reputation Points: 0
Solved Threads: 0
Newbie Poster
Boudou is offline Offline
11 posts
since Oct 2008
Oct 26th, 2008
0

Re: How I can implement Swap Arays function??

C++ Syntax (Toggle Plain Text)
  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. }
Reputation Points: 46
Solved Threads: 0
Light Poster
uim_1977 is offline Offline
25 posts
since Oct 2008
Oct 26th, 2008
0

Re: How I can implement Swap Arays function??

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
Reputation Points: 46
Solved Threads: 0
Light Poster
uim_1977 is offline Offline
25 posts
since Oct 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Please HELP!!!!!!
Next Thread in C++ Forum Timeline: Classes help on getting stockcount





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC