Dynamic Array Creation using malloc()

Write a C program to dynamically allocate memory for N integer elements using malloc().

The program should:

  • Ask the user to enter the size of the array
  • Allocate memory dynamically
  • Read elements from the user
  • Display all elements
  • Free the allocated memory

Live Preview