NVIDIA Interview Question
Software Engineer InternsCountry: United States
There are compiler predefined macros that can do this check ,
#if defined(__sparc)
/* SPARC ---------------------------------------------------- */
#endif
#if defined(__x86_64__) || defined(_M_X64)
/* x86 64-bit ----------------------------------------------- */
#elif defined(__i386) || defined(_M_IX86)
/* x86 32-bit ----------------------------------------------- */
#endif
bool isLittleEndian(){
- yoyoyo January 23, 2015int a = 0x12345678;
char *x = &a;
return x[0] == 0x78;
}