C language problem

Please support our C advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Feb 2005
Posts: 2
Reputation: bill13 is an unknown quantity at this point 
Solved Threads: 0
bill13 bill13 is offline Offline
Newbie Poster

C language problem

 
0
  #1
Feb 26th, 2005
can anyone help me with the above problem?
i need the code in C language.
the problem is:
Store random numbers into two-dimensional array of 6 * 6 and interchange first 3 rows with last three rows
thanks you in advance.
Reply With Quote Quick reply to this message  
Join Date: Apr 2004
Posts: 27
Reputation: Gnome_101 is an unknown quantity at this point 
Solved Threads: 0
Gnome_101 Gnome_101 is offline Offline
Light Poster

Re: C language problem

 
0
  #2
Feb 26th, 2005
Do you have any code to show me that u've tried?

a two dimensional array is int blah [][];

there's a start for you!
Reply With Quote Quick reply to this message  
Join Date: Apr 2004
Posts: 4,414
Reputation: Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future 
Solved Threads: 248
Team Colleague
Dave Sinkula's Avatar
Dave Sinkula Dave Sinkula is offline Offline
long time no c

Re: C language problem

 
0
  #3
Feb 26th, 2005
  1. void foo(int a[6][6])
  2. {
  3. int i, swap[6];
  4. for (i = 0; i < 3; ++i)
  5. {
  6. memcpy(swap, a[i], sizeof swap);
  7. memcpy(a[i], a[5 - i], sizeof swap);
  8. memcpy(a[5 - i], swap, sizeof swap);
  9. }
  10. }
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
Reply With Quote Quick reply to this message  
Reply

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


Thread Tools Search this Thread



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

©2003 - 2009 DaniWeb® LLC