I'm trying just to get my code to compile to see if it all works like planned, but I keep getting the error
c:44: error: expected expression before â%â token
My code is below
int main(int argc, char* argv[])
{
if (argc<1)
{
printf("Incorrect number of arguements\n");
return 0;
}
Player* head = NULL;
Player* node = NULL;
char name[NAME_LENGTH], champion[CHAMP_LENGTH], team[TEAM_LENGTH];
char temp;
int kills, deaths = 0;
FILE *in = fopen(argv[1], "r");
while (1)
{ /*error is here*/
fscanf(in, "%s%c%s%c%s%c%d%c%d%c", name, &temp, champion, %temp, team, &temp, &kills, &temp, &deaths, &temp);
if (feof(in)) break;
node = new_player(name, champion, team, kills, deaths);
head = insert_by_player(head, node);
}
return 0;
}
You have %temp
instead of &temp
in the parameter list of fscanf
.
But note that you can write:
fscanf("%d%*c%d", &a, &b);
The "%*c"
means read but then ignore a character, so you do not need the dummy &temp
at all.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments