Page 1 of 1

Why do we write (int *) before malloc?

Posted: Wed Jul 13, 2022 7:54 pm
by answerhappygod
int *ip = (int *)malloc(sizeof(int));
a) It is for the syntax correctness
b) It is for the type-casting
c) It is to inform malloc function about the data-type expected
d) None of the mentioned