Tuesday, 11 September 2012

shifting array rows up


i have array of nxm elements.
want remove array[0]; move up; add array[n-1].

use memcpy shifting? there better way?

 

you can't use memcpy because if memory regions overlap behavior undefined. can use memmove() it, same except memory regions may overlap (you can manually of course).

code:
      int size = 10;      int a[] = {1,2,3,4,5,6,7,8,9,10};        memmove(a, + 1, (size - 1) * sizeof(int));  
 


Forums Macs Mac Programming


  • iPhone
  • Mac OS & System Software
  • iPad
  • Apple Watch
  • Notebooks
  • iTunes
  • Apple ID
  • iCloud
  • Desktop Computers
  • Apple Music
  • Professional Applications
  • iPod
  • iWork
  • Apple TV
  • iLife
  • Wireless

No comments:

Post a Comment