int n;
scanf("%d ",& ampn);
int * a =(int *)malloc(n * sizeof(int));
The parameter of malloc is the size of allocated space, and n*sizeof(int) represents the allocation of n integer spaces. Because the first address returned by malloc is void, it is cast to int.
Malloc is used for dynamic allocation and can be allocated when needed. In practical application, it can be converted into the type you need according to your needs.