Advertisement
xerpi

test

Apr 14th, 2012
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.55 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <malloc.h>
  3.  
  4. typedef unsigned int u32;
  5.  
  6. void memorycopy(u32 *from, u32 *to, u32 size);
  7.  
  8.  
  9. int main(){
  10.     int *a = (int *)malloc(sizeof(int));
  11.     int *b = (int *)malloc(sizeof(int));
  12.     *a = 8;
  13.     *b = 5;
  14.     printf("a vale: %i y b vale: %i", *a, *b);
  15.  
  16.     memorycopy(a, b, sizeof(int));
  17.  
  18.     printf("\n\n\na vale: %i y b vale: %i", *a, *b);
  19.  
  20.     getchar();
  21.     return 0;
  22. }
  23.  
  24.  
  25. void memorycopy(u32 *from, u32 *to, u32 size){
  26.     u32 i;
  27.     for(i = 0; i < size; i++)
  28.         *(u32 *)(to++) = *(u32 *)(from++);
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement