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