This is probally a newbie question (shocking becuase im a newbie) but ive looked in my C book, with google, everything, and I can't find it.
My question is, how do you fill an array thats in a structure? in other words, i have a structure that i pass through all my functions, and in that structure is an array (int teamstats[5][18).
I want to fill that array on the load of the program with the following data:
int teamstats[][18] = {
{99 ,97, 85, 82, 61, 75, 72, 87, 93, 87, 99, 26, 87, 87, 86, 85, 87, 68},
{94, 96, 84, 81, 65, 85, 28, 86, 85, 97, 87, 94, 78, 95, 76, 90, 87, 68},
{93, 95, 83, 80, 60, 87, 68, 97, 95, 75, 86, 89, 96, 78, 85, 78, 87, 68},
{99, 99, 88, 77, 66, 96, 93, 64, 75, 86, 97, 86, 82, 89, 76, 81, 87, 68}
} ;
but I found i can't declare it like you can with a normal array (aka teamstats[][18] = {"5", "43", "34"....etc.
im at a lost, any help would be greatly appreciated.
thanks!
Code:struct var { int teamstats[5][18]; }; void fill(struct var *); void main(void) { struct var global; flil(&global); } void fill(struct var *global) { /* put code here to fill array with this data: {99 ,97, 85, 82, 61, 75, 72, 87, 93, 87, 99, 26, 87, 87, 86, 85, 87, 68}, {94, 96, 84, 81, 65, 85, 28, 86, 85, 97, 87, 94, 78, 95, 76, 90, 87, 68}, {93, 95, 83, 80, 60, 87, 68, 97, 95, 75, 86, 89, 96, 78, 85, 78, 87, 68}, {99, 99, 88, 77, 66, 96, 93, 64, 75, 86, 97, 86, 82, 89, 76, 81, 87, 68} */ }