If I need to treat something as an unsigned char array, is this the correct way for a function:
int main() {
int i = 500;
f(&i);
}
void f(void *ptr) {
unsigned char *byteptr = static_cast<unsigned char *>(ptr);
...
}
What if I don't have a function? Should I use two static_cast, first to void * and then to unsigned char *?