【2.12】C语言学习笔记14——详解指针1
(1)字符指针
除了将一个字符的地址放在字符指针中,还可以将字符串的首地址放在字符指针中。
一道笔试题:
char str1[] = "hello bit.";
char str2[] = "hello bit.";
const char *str3 = "hello bit.";
const char *str4 = "hello bit.";
if(str1 ==str2)
printf("str1 and str2 are same/n");
else
printf("str1 and str2 are not same/n");
if(str3 ==str4)
printf("str3 and str4 are same/n");
else
printf("str3 and str4 are not same/n");
答案:
原因:
在const char *str3 = "hello bit.";和const char *str4
共有 0 条评论