File:  [MW Coherent from dump] / coherent / d / usr / src / examples / calloc.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Wed May 29 04:56:38 2019 UTC (7 years, 2 months ago) by root
Branches: MarkWilliams, MAIN
CVS tags: relic, HEAD
coherent

#include <stdio.h>

main()
{
	register char *ptr, *ptr2;
	extern char *calloc(), *realloc();
	unsigned count, size;

	count = 4;
	size = sizeof(char *);

	if ((ptr = calloc(count, size)) != NULL)
		printf("%u blocks of size %u calloced\n",
		        count, size);
	else
		printf("Insuff. memory for %u blocks of size %u\n",
		     count, size);

	if ((ptr2 = realloc(ptr,(count*size) + 1)) != NULL)
		printf("1 block of size %u realloced\n",
			(count*size)+1);
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.