char *str = "fsdfsfs";
打印如下代表含义
*str :字符串首字母
str :字符常量
&str , 指针str的地址
字符串首地址
C:
printf("0x%X\n",(int)cstr);
C++:
cout << static_cast<const void*>(cstr)
本文介绍了 C 和 C++ 中的字符串操作基础知识,包括如何获取字符串的首字母、字符常量的意义、指针变量的地址及字符串首地址的表示方法。同时,通过示例代码展示了如何使用 printf 和 cout 函数输出这些信息。
char *str = "fsdfsfs";
打印如下代表含义
*str :字符串首字母
str :字符常量
&str , 指针str的地址
字符串首地址
C:
printf("0x%X\n",(int)cstr);
C++:
cout << static_cast<const void*>(cstr)

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