Witam,
Tak jak w temacie proszę o ocenę kodu źródłowego. Z góry dziękuję za poświęcony czas.
struct Lista
{
Lista *next;
float data;
};
Lista *DodajL(Lista *L, float wartosc)
{
if (L == NULL)
{
L = (Lista*)malloc(sizeof(Lista));
L->data = wartosc;
L->next = 0;
}
else
{
Lista *nl = (Lista*)malloc(sizeof(Lista));
nl->data = wartosc;
nl->next = 0;
while (L->next != 0) L = L->next;
L->next = nl;
return nl;
}
return L;
}
int LicznikEl(Lista *L)
{
if (L != 0)
{
int licznik = 1;
while (L->next != 0)
{
licznik++;
L = L->next;
}
return licznik;
}
else return 0;
}
Lista *Nastepny(Lista *L)
{
return L->next;
}
float Odczytaj(Lista *L)
{
return L->data;
}
void ZwolniListe(Lista *L)
{
if (L != 0)
{
while (L->next != 0)
{
Lista *dl = L;
L = L->next;
free(dl);
}
free(L);
}
}