# include <stdio.h>
void main(void)
{
int n = 5, * p;
p = &n;
printf("%d\n", &n);
printf("%d\n", p); //p = &n;
printf("%d\n", &(*p)); //p = &n,则*p = n,即&(*p) = &n;
printf("%d\n", *(&p)); //【个人理解:&p表示指针变量p的地址,则*(&p)=p】
/* 以上四个表达式输出的是同样的值 */
printf("%d\n", &p);// &p表示指针变量p的地址;
/* 该表达式输出的是p变量的地址值 */
printf("%d\n", n);
printf("%d\n", *p); // *p = n;
printf("%d\n", *(&n)); *(&n) = n;
/* 以上三个表达式输出的是同样的值:5 */
}
关于指针基础含意的程序示例及说明
最新推荐文章于 2022-09-17 15:47:04 发布