hmm..so i have this struct where i want to hold some user data and a value so i know if a control is enabled or disabled. then i want to have a pointer, so that i can cut down on code when changing between two sets of data. here's the code i have..
but at plyr=pone i get an error, "incompatible types in assignment".Code:struct player { int one[2]; int two[2]; int three[2]; int four[2]; int five[2]; int six[2]; int toak[2]; int foak[2]; int fh[2]; int ss[2]; int ls[2]; int yahtzee[2]; int chance[2]; }; struct player *plyr; struct player pone, ptwo; ..... /* test */ void ChangePlayer(HWND hwnd) { int i = 0; for (i = 500; i <= 512; i++) { SetDlgItemInt(hwnd, i, 0, FALSE); } EnableDisable(hwnd, FALSE, 500, 512); if (whosTurn == 1) { plyr = pone; } else if (whosTurn == 2) { plyr = ptwo; } else { MessageBox(0, "I have no idea who's turn it is..", "ERROR", MB_OK | MB_ICONEXCLAMATION); } SetDlgItemInt(hwnd, 600, plyr.one[0], FALSE); if (plyr.one[1] == 1) EnableDisable(hwnd, TRUE, 500, 0); }
could someone please tell me the error in my ways and how to get around this? i've tried googling some different combinations of pointer(s) and struct(s) but to no avail.
also, is there a way i could initialize each variable in the first position to 0 and in the second to one "automatically"? such that pone.one[0] == 0 && pone.one[1] == 1 ? like with char array's you can just go = {0}.?
thanks :]