PageRenderTime 40ms CodeModel.GetById 16ms RepoModel.GetById 1ms app.codeStats 0ms

/helpers/shiftmemcpy.c

http://github.com/msalvadores/quadindex
C | 19 lines | 12 code | 6 blank | 1 comment | 2 complexity | a6a8db0295108cdee1fd4d5b6938d3d3 MD5 | raw file
  1. /* memcpy example */
  2. #include <stdio.h>
  3. #include <string.h>
  4. #include <stdlib.h>
  5. int main(int argc,char **argv) {
  6. int *a = malloc(1024 * sizeof(int));
  7. for (int i=0;i<512;i++)
  8. a[i]=i;
  9. unsigned char *c = (unsigned char *)a;
  10. memcpy(c + (65 * sizeof(int)),c,(512 - 65) * sizeof(int));
  11. for(int i=0; i < 512 + 65;i++)
  12. printf("%i --> %i\n",i,a[i]);
  13. }