/* Demonstrates calloc(). */ #include #include main() { unsigned num; int *ptr; printf("Enter the number of type int to allocate: "); scanf("%d", &num); ptr = calloc(num, sizeof(int)); if (ptr != NULL) puts("Memory allocation was successful."); else puts("Memory allocation failed."); return(0); }