#include<stdio.h>
struct info {
char album[30];
int released;
char group[30];
};
int main() {
FILE * fpt;
int size;
struct info band[size];
int i;
printf("How many groups would you like to input: ");
scanf("%d",&size);
for (i=0; i<size; i++) {
printf ("Input what group: ");
scanf(" %s", band[i].group);
printf("Input released date: ");
scanf(" %d", &band[i].released);
printf("Input what album: ");
scanf(" %s", band[i].album);
}
fpt = fopen("records.dat", "w");
// printf("Group\t\tReleased\t\tAlbum\n");
for (i=0; i<size; i++) {
fprintf(fpt,"%s\t\t%d\t\t%s\n", band[i].group, band[i].released,
band[i].album);
}
printf("File created.\n");
fclose(fpt);
}
это выход :
ø -605554032 энтропия // но выходы следующей строки правильные