Returns true if the computer architecture is Big Endian, false otherwise.

View versions (1)

Interface

#include <codecogs/computing/lowlevel/is_big_endian.h>

using namespace Computing::Lowlevel;

For more information about the computer architecture theory behind this algorithm, please visit: http://en.wikipedia.org/wiki/Endianness

Example 1

The following program displays whether the computer architecture is Big Endian or not (the opposite would most probably be Little Endian, but there are also other non-Big Endian architectures).

#include <iostream>
#include <codecogs/computing/lowlevel/is_big_endian.h>

using namespace std;

int main() 
{
  cout << "Computer architecture is ";
  if (Computing::Lowlevel::isBigEndian()) cout << "Big Endian.";
  else cout << "Little Endian (or other non-Big Endian).";
  cout << endl;
  return 0;
}
GPL Licence — free for non commercial use. See Licence details.

Interactive Calculator

Result