![]() |
| ||
| changing array value... ok...i'm having trouble changing a value in a array into a character void gameon(int **game,int &size,int &x,int &y,int &score1,int &score2) i can't seem to change that specific number into 'X'.. can u guys help me out... |
| ||
| Re: changing array value... Two problems in one statement. game[x][j]=='X'; First, you're using the equality test ( == ) instead of assignment ( = ). Second, you're trying to assign a character to an integer variable. This will work (when you fix problem 1) but will not give you the result I think you're expecting. What will be assigned to the array element is the ASCII value of 'X' (which is 88, if I read my ASCII chart right.) If you want to mark the spot as used or free or whatever, you'll need to pick a value out of the range of allowable values. For instance, if the valid data can be any positive number greater than 0 (zero), use 0. If 0 could be a valid data item, how about some negative number? If all possible numbers are potentially valid, then you need some other way to indicate the cell is empty/available or whatever. Perhaps a parallel array where you simply mark 0 or 1 to indicate that the corresponding cell in the data array is available or not. |
| All times are GMT -4. The time now is 11:41 am. |
Forum system based on vBulletin Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
©2003 - 2010 DaniWeb® LLC