I was having a bit of trouble trying to interpret my input as hexadecimal numbers. For example if given the input of 40A2
, and assuming I have an array at size 216, how would I access the following example?
arr[0x40A2] //this is simply accessing the array at binary 0100 0000 1010 0010
which is at index 16546
I'm just having a bit of trouble with this because as the program receives input from the user, numbers come in interpreted as ASCII values, and need to be interpreted as hexadecimal values.