Curiosity of retrieving bytes of a data-type
Code:
const int GetByte(void* i, unsignedchar byte)
{
return(int)((&i)[byte]);
}
The given function ( i believe ) will return the specified byte of a given type. I have been using this to identify endian-ness, but I was wondering if there is a way to make this work on temporary.
Such as
will show the address, not the actual byte value
Although
works as expected.
I am sure I am just blindly over-looking some simple logic, but I thought I would ask.
Thank you sincerely.