请教前辈关于memcmp()的一个疑惑,太奇怪了
#include <string>
#include <cstdlib>
#include <iostream>
using namespace std;
int main()
{
string a = "aaa";
string b = "bbb";
cout << memcmp(&a, &b, a.size()) << endl;
system("pause");
return 1;
}
输出结果是0,但是a和b不相等不应当输出0啊?真是迷惑了…………
真心向大家请教,谢谢。