Похожие чаты

I'M sorry. I'm not expert enough. Just courius. What if you need

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) ?

4 ответов

12 просмотров

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.

Похожие вопросы

Обсуждают сегодня

Карта сайта