int *ptr = (int *)malloc(5 * sizeof(int));
if (ptr == NULL) {
    printf("Memory allocation failed.");
    return 1;
}