Guest User

Untitled

a guest
Oct 16th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.22 KB | None | 0 0
  1. char* createMemory() {
  2.     char *buf = malloc(100);
  3.     int *size = (int*)buf;
  4.     *size = 100;
  5.     return (char*)(size+1);
  6. }
  7.  
  8. void deleteMemory(char* buf) {
  9.     int* size = ((int*)buf)-1;
  10.     int blocksize = *size;
  11.     free(size);
  12. }
Add Comment
Please, Sign In to add comment