Here's a code snippet that runs ok:
struct person *ptr;
ptr = malloc(n * sizeof(struct person));
But on many C websites the second line is written as
ptr = (struct person*) malloc(n * sizeof(struct person));
My questions are: Is it wrong to NOT explicitly mention the type during such malloc()
statements? Why should I explicitly mention the type during such statements?