#include <stdio.h>
#include <stdlib.h>
struct date {
int day;
int month;
int year;
};
struct lottery {
int aa;
struct date date1;
int n1;
int n2;
int n3;
int n4;
int n5;
int joker;
};
void load(struct lottery *array) {
FILE *fp;
fp = fopen("as.txt", "r");
if (fp == NULL)
printf("00000\n");
int i;
for (i = 0; i < 1; i++) {
fscanf(fp, "%d;%d/%d/%d;%d;%d;%d;%d;%d;%d", &array[i].aa, &array[i].date1.day, &array[i].date1.month, &array[i].date1.year, &array[i].n1, &array[i].n2, &array[i].n3, &array[i].n4, &array[i].n5, &array[i].joker);
if (feof(fp))
break;
}
array = (struct lottery*)realloc(array, i * sizeof(struct lottery));
// printf("%d;%d/%d/%d;%d;%d;%d;%d;%d;%d", array[0].aa, array[0].date1.day, array[0].date1.month, array[0].date1.year, array[0].n1, array[0].n2, array[0].n3, array[0].n4, array[0].n5, array[0].joker);
}
int main() {
struct lottery *array;
array = (struct lottery *)malloc(4 * sizeof(struct lottery));
// printf("%d", sizeof(struct lottery));
load(struct lottery array);
printf("%d",array[0].aa);
return 0;
}
Hello, I get an error at the line load(struct lottery array);
in my main
function. The error says Expected expression before struct.
I googled it and I couldn't understand why would it expect an expression there and I am kinda confused.