2
0

alloc.c 322 B

1234567891011121314
  1. #include <stdlib.h>
  2. #include <unistd.h>
  3. int main(int argc, char **argv) {
  4. write(STDERR_FILENO, "malloc\n", 7);
  5. char * ptr = (char *)malloc(256);
  6. write(STDERR_FILENO, "set\n", 4);
  7. int i;
  8. for(i = 0; i < 256; i++) {
  9. ptr[i] = (char)i;
  10. }
  11. write(STDERR_FILENO, "free\n", 5);
  12. free(ptr);
  13. }