Hi, still very new to the C Language and just needed some Clearing up and some help please.
Im writing a program where i have to read from a file that says the name of a person and 6 "lottery" numbers in this format.
[ Mike Kobalt
12 15 34 37 45 50]
Then the user inputs the winning numbers and the output is the name and how much they won.
My question is How would we compare the winning numbers with the numbers from the text using parsing and malloc. Heres my code so far...keep in mind im new
#define MAXNUM 56
#define Win3 10
#define Win4 100
#define Win5 10000
#define Win6 1000000
int main() {
int i, size, tokensize *p; //declare variables and pointers
int a, b, c, d, e, f;
int num;
char filename[(2*tokensize)+1][6]
printf("Enter the name of the file with the ticket data\n");
scanf("%s",fileName);
FILE*pFile = fopen(filename,"r"); //open file
if(pFile != NULL) {
fscanf(pFile, "%d", tokensize); //Number of Cards
char *fgets(char*str,int num,FILE*stream); //gets the string and divides into tokens
char *strtok(char*astr, const char*delimeters);
char *p;
p=strtok(NULL, " ");
p=(int *)malloc(size*sizeof(tokensize)); //reads in the numbers of the array and allocates memory of the array
for(i=0; i<6; i++) //Should go through each token
fscanf(fp,%d, &p);
printf("Enter the Winning Lottery Numbers\n");
scanf("%d, %d, %d ,%d, %d, %d\n",str, &a, &b, &c, &d, &e, &f);
if(str == strtok)..