Struct C++ array in function parameters not working at all -
hello have programme using array of structures.. , have initialize in function. below trying, prototype keeps getting error "expected primary expression".. have followed tutorials cant figure out im doing wrong please help. cant utilize pointers or vectors.. basic stuff give thanks time
struct gamecases{ bool flag = false; int casenum; double value; }; int initialize(gamecases cases); //prototype
--- main()
gamecases cases[26]; initialize(cases); //call
int initialize(gamecases cases) //definition { double values[26] = {.01, 1, 5, 10, 25, 50, 75, 100, 200, 300, 400, 500, 750, 1000, 5000, 10000 , 25000, 50000, 75000, 100000, 200000 , 300000, 400000, 500000, 1000000, 2000000}; (int = 0; < 26; i++) { array[i].value = values[i]; } }
int initialize(gamecases cases[26]); //prototype int initialize(gamecases cases[26]) //definition { double values[26] = {.01, 1, 5, 10, 25, 50, 75, 100, 200, 300, 400, 500, 750, 1000, 5000, 10000 , 25000, 50000, 75000, 100000, 200000 , 300000, 400000, 500000, 1000000, 2000000}; (int = 0; < 26; i++) { cases[i].value = values[i]; } }
and call:
initialize(cases);
c++ arrays function struct structure
No comments:
Post a Comment