I wanted to ask about the following case:
char *temp;
temp=malloc(10);
Since the return type of malloc
is void
, will the pointer returned by the malloc
be implicitly cast to char
type before being assigned to temp? What does the standard say in this regard?
If our pointer variable is some struct type for ex.
struct node *temp;
temp=(struct node *)malloc(sizeof(struct node));
If we allocate memory to temp without casting it to struct node
type, will it be implicitly cast to struct node
type or is it necessary to explicitly cast it to struct node
type?