相同字符串常量初始化数组,指针;用==判断
int main()
{
const char* str1 = "123";
const char* str2 = "123";
cout <<"两个指针地址比较:"<< (str1==str2)<<endl;
char str3[] = "1234";
char str4[] = "1234";
cout <<"两个数组地址比较:"<< (str3 == str4)<<endl;
//==之比较字符串指针的地址值是否一样。若不是引用同一地址即使内容一样也会返回false
//strmp()比较字符串中具体内容
}
返回结果: