Guest User

Untitled

a guest
Apr 21st, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.38 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. #define S (1<<27)
  6.  
  7. int main(int argc, char* argv[])
  8. {
  9.     void *a, *b;
  10.  
  11.     a = malloc(S);
  12.     b = malloc(S);
  13.  
  14.     if (a == 0 || b == 0) {
  15.         puts("malloc failed\n");
  16.         return EXIT_FAILURE;
  17.     }
  18.     puts("malloced\n");
  19.  
  20.     while (1) {
  21.         memcpy(b,a, S);
  22.         puts("a->b\n");
  23.         memcpy(a,b, S);
  24.         puts("b->a\n");
  25.     }
  26.  
  27. }
Add Comment
Please, Sign In to add comment