C Programming

The sizeof() function returns the memory size of the requested variable. This call should be used in conjunction with the calloc() function call, so that only the necessary memory is allocated, rather than a fixed size. Consider the following,

	struct date {
		int hour, minute, second;

	int x;

	x = sizeof( struct date );

x now contains the information required by calloc() so that it can allocate enough memory to contain another structure of type date.

ęCopyright B Brown. 1984-1999. All rights reserved.