#include <stdio.h>
#include <stdlib.h>
struct Teams{
char name[20];
int wins,los,goalsl,goalss;
}nw,ne,sw,se;
void ar(struct Teams *nazwa){
int x;
printf("Ile druzyn?\n");
scanf("%d",&x);
nazwa =malloc(x*sizeof(struct Teams));
for(int i=0; i<x;i++){
scanf("%s",&nazwa[i].name);
}
}
void print(struct Teams *nazwa){
for(int i=0; i<4; i++){
printf("%s\n",nazwa[i].name);
}
}
int main()
{
struct Teams *nw,*ne,*sw,*se;
ar(&nw);
print(nw);
return 0;
}
Cześć!
Próbuję stworzyć dynamiczną tablicę struktur ale niestety nie działa mi to tak jak powinno. Pomożecie?