指针与数组的区别
来源:互联网 发布:易经入门 知乎 编辑:程序博客网 时间:2024/05/21 07:56
char *buf1="hello";
char *buf2="hello";
if(buf1==buf2)
cout<<"equal"<<endl;
else
cout<<"unequal"<<endl;
2.
char buf1[10]="hello";
char buf2[10]="hello";
if(buf1==buf2)
cout<<"equal"<<endl;
else
cout<<"unequal"<<endl;
char buf2[10]="hello";
if(buf1==buf2)
cout<<"equal"<<endl;
else
cout<<"unequal"<<endl;
指针是常量,不能改变字符串中字符的值
char *p="abc";
p="cde";
// p[1]='m'; 这句编译可以通过,但是运行就出错了
cout<<"p="<<p<<endl; 打印出cde
cout<<"p[1]="<<p[1]<<endl; 打印出d
p="cde";
// p[1]='m'; 这句编译可以通过,但是运行就出错了
cout<<"p="<<p<<endl; 打印出cde
cout<<"p[1]="<<p[1]<<endl; 打印出d
- 数组指针与指针数组的区别
- 数组指针与指针数组的区别
- 数组指针与指针数组的区别
- 数组指针与指针数组的区别
- 数组指针与指针数组的区别
- 数组指针与指针数组的区别
- 数组指针与指针数组的区别
- 指针数组与数组指针的区别
- 指针数组与数组指针的区别
- 指针数组与数组指针的区别
- 数组指针与指针数组的区别
- 数组指针与指针数组的区别
- 指针数组与数组指针的区别
- 数组指针与指针数组的区别
- 数组指针与指针数组的区别
- 指针数组与数组指针的区别
- 指针数组与数组指针的区别
- 指针数组与数组指针的区别
- 13 C# 第十二章 委托
- 字符、字符数组、char、string的区别分析
- Extjs-布局
- linux加硬盘
- 开博第一篇文章
- 指针与数组的区别
- 类成员函数的重载、覆盖和隐藏区别
- tomcat启动时卡在couchbase连接上的解决办法(真凶原来是avast)
- 简述数组与指针的区别
- struts标签中<s:action>的用法
- 两个字符串相加用指针实现
- c++中箭头操作符(->)和点操作符(.)有什么不同
- c++反汇编总结
- c++中的字符串