I know this question may be marked as a duplicate of difference between malloc and calloc but still i would like to ask it.
i know calloc initilizes the memory block,here my question is not focusussing on that part.
my question is
the definition of malloc says it allocates a block of memory of specified size.
and calloc says it allocates multiple block of memory ,each of the same size.
is this allocation of one block of memory and multiple blocks of memory is a real difference between the two?
because i feel we can do the same using malloc which can be done by calloc.
for example :
int *ptr;
ptr=(int *) malloc(100 * (sizeof(int)));
and
int *ptr;
ptr=(int *) calloc(100,sizeof(int));
would end up allocating 100 times the memory required by the int.