Figured it out, nevermind!
Ellay K.
Printable View
Figured it out, nevermind!
Ellay K.
You're reading an unsigned char out of the inner vector, then cast that to a pointer to an uint8_t, which is nonsense, because the unsigened char from the vector certainly does not contain the memory address of anything, and then try to read from that non-address, which triggers the exception. Simply remove the entire cast, including both the * and you'll be fine:
The cast is completely unnecessary here anyway, since the conversion from unsigned char to int is performed completely seamlessly by the C+ compiler. You'll probably not even get a compiler warning about converting between types of different signdness.Code:int temp = data[i][j];
This is a perfect demonstration of the fact that casts in general are dangerous and should be avoided if possible. And the reinterpret cast is particularly dangerous.