Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // Using the malloc() ANSI-C function
- //
- #include <stdio.h>
- #include <alloc.h>
- #define MY_BLOCK_SIZE 256
- void main()
- {
- char *my_mem_block;
- my_mem_block = (char *)malloc(sizeof(char) * my_mem_block);
- if (my_mem_block){
- printf("%d bytes allocated.\n", MY_BLOCK_SIZE);
- free(my_mem_block);
- }
- else
- printf("malloc() failed.\n");
- }
Add Comment
Please, Sign In to add comment