Guest User

Untitled

a guest
Jul 21st, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. //
  2. // Using the malloc() ANSI-C function
  3. //
  4.  
  5. #include <stdio.h>
  6. #include <alloc.h>
  7.  
  8. #define MY_BLOCK_SIZE 256
  9.  
  10. void main()
  11. {
  12. char *my_mem_block;
  13. my_mem_block = (char *)malloc(sizeof(char) * my_mem_block);
  14. if (my_mem_block){
  15. printf("%d bytes allocated.\n", MY_BLOCK_SIZE);
  16. free(my_mem_block);
  17. }
  18. else
  19. printf("malloc() failed.\n");
  20. }
Add Comment
Please, Sign In to add comment