#include #include int main() { int *ptr = (int *)malloc(5 * sizeof(int)); // Allocates memory for 5 integers if (ptr == NULL) { printf("Memory allocation failed\n"); return 1; } for (int i = 0; i < 5; i++) { ptr[i] = i + 1; printf("%d ", ptr[i]); } free(ptr); // Always free memory after use return 0; }