简体   繁体   English

指针地址

[英]Address of pointers

Looking at the following Code:查看以下代码:

char* c = (char*) malloc(sizeof(char)*BUF);

I know that doing我知道这样做

printf("%c\n", *c);

gives me the first character in the string.给我字符串中的第一个字符。 Also,还,

printf("%s\n", c);

prints the whole string, where c is the address of the first character.打印整个字符串,其中 c 是第一个字符的地址。 However, what is the meaning of &c?但是,&c是什么意思呢? Is it the address of the address?是地址的地址吗? Thanks in advance!提前致谢!

&c是变量c的地址(它本身包含分配数组的地址)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM