#include #include int main(int argc, char *argv[]) { // calloc zeroes the allocated memory. // It has slightly different syntax than malloc. // Here we allocate an array of 10 ints. int *ptr = (int*)calloc( 10, sizeof(int) ); printf("ptr[4] = %d\n", ptr[4]); typedef struct { int length; char buffer[20]; } ExampleStruct; ExampleStruct *sptr = calloc( 10, sizeof(ExampleStruct) ); printf("The buffer in element 2 has string '%s'\n", sptr[2].buffer); // NOTE THE MEMORY LEAKS HERE... return 0; }