|
|
1.1 root 1: #include <stdio.h>
2:
3: main()
4: {
5: register char *ptr, *ptr2;
6: extern char *calloc(), *realloc();
7: unsigned count, size;
8:
9: count = 4;
10: size = sizeof(char *);
11:
12: if ((ptr = calloc(count, size)) != NULL)
13: printf("%u blocks of size %u calloced\n",
14: count, size);
15: else
16: printf("Insuff. memory for %u blocks of size %u\n",
17: count, size);
18:
19: if ((ptr2 = realloc(ptr,(count*size) + 1)) != NULL)
20: printf("1 block of size %u realloced\n",
21: (count*size)+1);
22: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.