问个memcmp使用的问题
#include <iostream>
#include <string.h>
using namespace std;
int main()
{
int a=1;
int b=256;
if(memcmp(&a,&b,sizeof(int))<0)
cout<<"1<256"<<endl;
else
cout<<"1>256"<<endl;
return 0;
}
为什么输出 1>256,好像只比较了一个字节。
一直没搞清楚。
求教一下上述memcmp使用有什么问题?
多谢~