User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C section within the Software Development category of DaniWeb, a massive community of 391,601 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,626 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C advertiser:

Swap an array...

Join Date: Oct 2007
Location: Cherry Hill, NJ
Posts: 1,809
Reputation: Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold 
Rep Power: 11
Solved Threads: 184
Featured Poster
Duoas's Avatar
Duoas Duoas is offline Offline
Posting Virtuoso

Re: Swap an array...

  #7  
May 16th, 2008
Good grief!

n.aggel, you had the right idea to begin with, only your syntax needs help. Don't change the definition of the function, but just pass the appropriate pointer.

  1. void array_function(int rows, int cols, float after[rows][cols] , float before[rows][cols])
  2. {
  3. ...
  4. }
  5.  
  6. int main()
  7. {
  8. int n = 5;
  9. int m = 6;
  10.  
  11. int before[n][m];
  12. int after[n][m];
  13.  
  14. array_function( 5, 6, before, after ); // this works
  15. array_function( 5, 6, after, before ); // this works
  16.  
  17. ...
  18. }

Hope this helps.
Reply With Quote  
All times are GMT -4. The time now is 11:52 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC