Cześć. Jak przekazać w tym przypadku strukturę do funkcji aby ta wiedziała co to jest head, element, temp?
#include<stdio.h>
#include<stdlib.h>
typedef struct lista{
struct lista *next,*prev;
int war;
}el_listy;
void dodaj(el_listy , int liczba)
{
if(element==NULL)
{
element=(el_listy*)malloc(sizeof(el_listy));
element->war=liczba;
head->next=element;
element->prev=head;
element->next=head;
head->prev=element;
temp=element;
}
else
{
element=(el_listy*)malloc(sizeof(el_listy));
temp->next=element;
element->prev=temp;
element->next=head;
head->prev=element
head->next=element;
temp=element;
}
}
int main()
{
int i;
el_listy a;
el_listy *head=&a;
el_listy *element=&a;
el_listy *temp=&a;
element=NULL;
head->war=1;
head->next=head;
head->prev=head;
for(i=0;i<10;i++)
dodaj(head,i);
getchar();
return 0;
}