Can't figure out how to remove the error.please help in removing segmentation fault (core)
struct node
{
int a;
node * link;
}**u;
u = (struct node**) malloc( m * sizeof(struct node*) );
struct node *f = u[z-1]; // z is int
while(f->k!=x && f!=NULL)
{
f = f->link;
count = count + 1;
}
if(f->k!=x )
{
printf("-1");
}
else
{
printf("%ld",count);
}