c - Assigning unknown values in an array to variables -
okay have array of 9 integers. of values given , unknown. how assign integer variable such 'a' - 'z' these unknown values? example:
index [0] unknown index [1] 27 index [2] 6 index [3] 9 index [4] unknown index [5] 21 index [6] 24 index [7] 3 index [8] unknown
i want
index [0] index [1] 27 index [2] 6 index [3] 9 index [4] b index [5] 21 index [6] 24 index [7] 3 index [8] c (ii=0; ii<maxline/2; ii++) { if (uniquenumbers[ii] == unknown_input) { printf("unkown_input @ [%d]\n", ii); } }
since not seem use negative values (you mark unknown -1) use negative ascii value of chars store information.
index [0] (-97) index [1] 27 index [2] 6 index [3] 9 index [4] b (-98) index [5] 21 index [6] 24 index [7] 3 index [8] c (-99)
when printing use (char)(-1 * index[i])
.
Comments
Post a Comment