doubt in malloc

Is the following statement correct???
int *s = malloc(sizeof(int)100);
I am asking this that till date i have encountered the declaration of malloc only as
int *s = malloc(sizeof(int));
Does this mean that a single block of size 100*4 is reserved in memory??
and is this different from the following
int *s=calloc(sizeof(int),100);
No. You need to use the multiplication operator
int *s = malloc(sizeof(int) * 100);
This will allocate space for 100 ints.

The only difference with the call to calloc is that it will zero-initialize the memory.
Topic archived. No new replies allowed.