写一个代码,验证自己的电脑是大端模式还是小端模式?
#include <stdio.h>
union test
{
int a;
char b;
};
int main()
{
union test t;
t.a = 1;
if( t.b )
{
printf("小端模式 \n");
}
else
{
printf("大端模式 \n");
}
}
写一个代码,验证自己的电脑是大端模式还是小端模式?
#include <stdio.h>
union test
{
int a;
char b;
};
int main()
{
union test t;
t.a = 1;
if( t.b )
{
printf("小端模式 \n");
}
else
{
printf("大端模式 \n");
}
}