๋‚ด ์ปดํ“จํ„ฐ๊ฐ€ Little endian์ธ ์ง€, Big endian์ธ ์ง€ ํ™•์ธํ•ด๋ณด์ž!

์ „์ฒด ์ฝ”๋“œ

๊ฐ€๋ณ๊ฒŒ ์•„๋ž˜ ์†Œ์Šค๋ฅผ ์ปดํŒŒ์ผ&๋นŒ๋“œ ํ›„ ์‹คํ–‰ํ•ด๋ณด์ž !

#include <iostream>

using namespace std;

int main(int argc, char** argv)
{

  int i = 0x00000001;

  if ( ((char *)&i)[0] )
    cout << "Little" << endl;
  else
    cout << "big" << endl;

  return 0;
}

Reference

Leave a comment