title: Error "initializer element is not constant" when allocate the memory
body: <pre><code>  1 #include&lt;stdio.h&gt;
    2 #include&lt;malloc.h&gt;
    3 
    4 typedef struct node_t{
    5     int i;
    6     struct node_t* link;
    7 }node;
    8 
    9 node* head = (node *)malloc(sizeof(node));
   10 
   11 if(head == NULL){
   12     printf("\n malloc for head node failed! \n");
   13 }
   14 
   15 int main(){
   16     int i = 10;
   17     node* temp = NULL;
   18     temp = (node *)malloc(sizeof(node));
   19     if(temp == NULL){
   20         printf("\n malloc for temp node failed! \n");
   21     }
   22     else{
   23         while(i&lt;=10){
   24             ;
   25         }
   26     }
   27     return 0;
   28 } 
  </code></pre>
  
  <p>compilation error:</p>
  
  <pre><code>linked.c:9:1: error: initializer element is not constant
  linked.c:11:1: error: expected identifier or â€˜(â€™ before â€˜ifâ€™
  </code></pre>
  
  <p>I'm trying a simple linked list programme. It's not fully completed. I'm getting a compilation error. Couldn't understand why this happened.</p>