#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct element
{
char a[25];
char b[25];
struct element *next;
};
void dodaj(struct element *start, char *x, char *y)
{
struct element *tmp = (struct element*)malloc(sizeof(struct element));
strcpy(tmp->a, x);
strcpy(tmp->b, y);
if(start==NULL)
{
start=tmp;
tmp->next=NULL;
}
else
{
tmp->next=start;
start=tmp;
}
}
int main()
{
struct element *start, *pomoc;
char x[25]="Amek", y[25]="lel";
start=NULL;
dodaj(start, x, y);
printf("%s", start->a);
return 0;
}
Problem polega na tym, że ta procedura DODAJ nie działa, nie umiem zrozumieć dlaczego.
Wypisuje mi ze start=NULL. Nie umiem znaleźć błędu. Ktoś może pomóc?