代码如下:
1 #include <iostream> 2 #include <arpa/inet.h> 3 #include <cstdio> 4 5 using namespace std; 6 7 int main(){ 8 9 short s=1; 10 if(s == htons(s))cout<<"大端"<<endl; 11 else cout<<"小端"<<endl; 12 13 return 0; 14 }
时间: 2024-10-10 08:01:33
代码如下:
1 #include <iostream> 2 #include <arpa/inet.h> 3 #include <cstdio> 4 5 using namespace std; 6 7 int main(){ 8 9 short s=1; 10 if(s == htons(s))cout<<"大端"<<endl; 11 else cout<<"小端"<<endl; 12 13 return 0; 14 }