Request for member 'next' in something not a structure or union
<p>I am trying to write a function to delete the first node in the linked list, but I am getting the following error: </p>

<pre><code>prog.c: In function 'del':
prog.c:38:13: error: request for member 'next' in something not a structure or union
    head=head-&gt;next;
             ^
</code></pre>

<p>Any help is highly appreciated. Below is my code:</p>

<pre><code>#include&lt;stdio.h&gt;
#include&lt;stdlib.h&gt;
struct node{
int data;
struct node* next;
};

int length(struct node* head)
{
struct node* current=head;
int count=0;
while(current!=NULL)
{
    count++;
    current=current-&gt;next;

}
return count;
}

void push(struct node** head, int ndata)
{
struct node* new_node=(struct node*) malloc(sizeof(struct node));
 new_node-&gt;data  = ndata;
  new_node-&gt;next = (*head);
  *head=new_node;


 }

void del(struct node** head)
{
if(head==NULL)
return;
else
{
struct node *temp=*head;
 head=head-&gt;next;     // Line 38
 printf("data del is %d\n", temp-&gt;data);
 free(temp);
}

}

int main()
{

struct node* head = NULL;

push(&amp;head, 1);
push(&amp;head, 3);
push(&amp;head, 1);
push(&amp;head, 2);
push(&amp;head, 1);

printf("count of nodes is %d", length(head));
del(&amp;head);

return 0;
}
</code></pre>