memset

http://blog.csdn.net/songuooo/article/details/7819790

 字符指针、字符串

 1 int main()
 2 {
 3     char *s1 = "abc";//s1在栈上,"abc"在字符常量区,s3也指向这个"abc"
 4     char *s3 = "abc";//"abc"在栈上
 5     char s2[] = "abc";
 6     cout << &(s2[0]) << endl;//以下四条语句都是输出abc
 7     cout << &s1[0] << endl;
 8     cout << &s3[0] << endl;
 9     cout << s1 << endl;
10     cout << strcmp(s1, s2) << endl;
11     cout << (s1 == s2) << endl;//判断是否指向同一地址
12     printf("%p,%p,%p", s1, s2, s3);
13 }

 

posted @ 2017-09-30 12:09  hchacha  阅读(172)  评论(0)    收藏  举报