it is usually the case that to dynamically allocate an array of n elements.
we do this:
malloc(n*sizeof(int));
but it seems to work even if we allocate only sizeof 1 int and then do this.
The below code works,so what is need to malloc 5*4 bytes? instead just malloc the 1st block
#include <stdio.h>
#include <stdlib.h>
int main()
{
int *a = malloc(sizeof(int));
int i;
for(i=0;i<5;i++)
scanf("%d",a+i);
for(i=0;i<5;i++)
printf("%d\n",a[i]);
free(a);
}