How to use struct in this case

donna

The code:

struct result
{
  char won[MAX_NAME_LEN+1];
  char lost[MAX_NAME_LEN+1];
};

void add_to_scoreboard(struct result * scoreboard, 
struct result * latest_game)
{
  if (latest_game = struct result * won)
    {

    }
}

When I try to compile this I get the error:

error: expected expression before ‘struct’
 if (latest_game = struct result * won)

I am new to c programming and I am trying to make it so that if a players result in the last game was a win they will be added to the scoreboard as a winner and the loser of that round be added on the scoreboard as a loser. Am I missing something in the code or is there another way I should be writing this all together?

jh314

You can access the won property of latest_game with latest_game->won rather than latest_game = struct result * won

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related