#include <stdio.h>
#include <stdlib.h>
int main() {
int *arr, n, i;
// Ask how many integers to store and use calloc()
printf("Enter the number of integers to store: ");
scanf("%d", &n);
arr = (int *)calloc(n, sizeof(int)); // Using calloc instead of malloc
if (arr == NULL) {
printf("Memory allocation failed!\n");
return 1;
}
// Display values after calloc (initialized to zero)
printf("After calloc, the integers are (initialized to zero): \n");
for (i = 0; i < n; i++) {
printf("%d ", arr[i]);
}
printf("\n");
// Free the memory at the end
free(arr);
return 0;
}