I have problem with linked lists. I have two structures:
struct ekstra
{
char isim[256];
int deger;
struct ekstra *sonra;
};
struct node
{
char name[256];
int val;
struct ekstra *next;
};
and I have these:
struct ekstra *tmp;
struct node dizi[12];
Somewhere in my code there is
tmp = dizi[k].next;
tmp=tmp->sonra;
and if I do this:
tmp = malloc(sizeof(struct ekstra));
there is no problem.
But if I do this:
dizi[k].next->sonra = malloc(sizeof(struct ekstra));
I get a SegFault. Why is this happening?
k. Please post full code