Hi all, I am having a little bit of difficulty initialising a 2d array, for a player of type struct.
I've created a struct to represent a player, and created two players of this struct type, as so:
Code:
struct player
{
int scoreC, scoreT, startScore, numDarts, legs, sets;
int scoreCC[2][8];
float dartAve;
char name[15];
};
struct player player1, player2;
I have created a 2d array to represent their score (the zeros will be updated as the game progresses):
Code:
player1.scoreCC[2][8] = {15,16,17,18,19,20,25,50,
0, 0, 0, 0, 0, 0, 0, 0};
However the compiler just says "parse error before '{' token" which isn't giving me much to go on really. I have tried doing it for a 2d integer array that isn't part of a struct and it works fine:
Code:
int scoreCC[2][8] = {15,16,17,18,19,20,25,50,
0, 0, 0, 0, 0, 0, 0, 0};
What am I doing wrong? I haven't been doing C for very long so I presume I'm making some silly error.