Save lots of RAM? Not really.
Here's a union example to find the byte order of a system.
#include <iostream>
int main(int argc, char**argv)
{
union
{
short s;
char c[sizeof(short)];
} un;
un.s = 0x0102;
if (sizeof(short) == 2)
{
if ( un.c[0] == 1 && un.c[1] == 2 )
std::cout << "Big endian" << std::endl;
else if ( un.c[0] == 2 && un.c[1] == 1 )
std::cout << "Little endian" << std::endl;
}
return 0;
}