-
accesing struct members
K i was wondering if i have a struct square with bool _1 ,_2, _3
can i acces them like this
Code:
square box;
for (int x=1;x>3;x++)
{
box.'_+x'=false;
}
Basically i am trying to safe some space instead of doing this
Code:
box._1=false;
box._2=false;
box._3=false;
See what i am trying to do? Thanks i just got a lot of them 9 but if i have to do that everytime i need to acces them all it will take lot of code thanks and i am making sudoku solver thanks again.
-
Use an array it looks like this.
Code:
struct myStruct
{
//creates 5 ints
int vals[5];
};
int main()
{
myStruct ms;
for(int i = 0; i < 5; i++){
//Set each val to 1
ms.vals[i] = 1;
}
return 0;
}
-
Yah but hmm this might work let me try this have anyone made sudoku solver and have anyhints?