Determine the machine byte order size end

#include <stdio.h>

int main() {
    int x = 0x1020304;
    char* p = (char*)&x;
    puts(p[0] == 1 ? "Big endian" : "Little endian");
    return 0;
}

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324395660&siteId=291194637