to allocate pointer to 10 int.
Dont you think
int *p = malloc(sizeof(int) * 10)
is easier to read and compatible than
int *p = malloc(40) ?
This case is different
But you're allocating ints here
always do the first, even if sizeof(char) is redundant
Not only is it easier to read, it's more correct.
Обсуждают сегодня