#include <iostream>
using namespace std;
int main(){
char str1[] = "hello";
char str2[] = "hello";
char *str3="hello";
char *str4="hello";
cout << (str1==str2) << endl;
cout << (str3==str4) << endl;
}
指针与数组
最新推荐文章于 2025-03-05 18:04:25 发布
本文提供了一个使用C++进行字符串比较的简单示例。通过直接比较字符数组和指向字符的指针,演示了如何判断两个字符串是否相同。示例中使用了标准输入输出流来进行结果展示。
2611

被折叠的 条评论
为什么被折叠?



