|
|
|
#include <stdio.h>#include <stdlib.h>#include <unistd.h>int main(int argc, char **argv){ int i = 1; char *cp = (char *)&i; if (*cp) //如果此时cp指向的内存为1的话,则为小端,否则为大端。 printf("Little Endian\n"); else printf("Big Endian\n"); exit(EXIT_SUCCESS);} |
|