Two problems in one statement.
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.
Reputation Points: 1268
Solved Threads: 228
Posting Virtuoso
Offline 1,895 posts
since Aug 2007