若有定义char* p="computer";则表示p的值是字符串" computer "。
时间: 2023-07-02 12:24:21 浏览: 151
不完全正确。定义char* p="computer"表示p是一个指向字符串"computer"的指针,即p指向字符串常量的首地址。在C语言中,字符串常量是以null字符('\0')结尾的字符数组,所以字符串"computer"实际上是由7个字符组成的,最后一个字符是'\0'。因此,p指向的是字符数组的首地址,也就是字符'c'的地址。如果需要访问字符串中的某个字符,可以通过指针偏移来访问。例如,*(p+2)表示访问字符串中的第三个字符,即字符'm'。
相关推荐
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://img-home.csdnimg.cn/images/20210720083646.png)
![pptx](https://img-home.csdnimg.cn/images/20210720083543.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![doc](https://img-home.csdnimg.cn/images/20210720083327.png)
![doc](https://img-home.csdnimg.cn/images/20210720083327.png)
![doc](https://img-home.csdnimg.cn/images/20210720083327.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)