关于指针基础含意的程序示例及说明
2014-04-14 10:59
204 查看
# 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 */
}
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 */
}
相关文章推荐
- CaysnPrinter开发包接口说明文档及示例程序 - CAYSN IOS SDK_20160906
- 微信小程序开发教程(基础篇)4-关于回调函数,匿名函数,闭包的杂谈
- 关于windows程序相关基础技术的一点小结(3.windows GDI 篇)
- CaysnPrinter - Linux平台开发包接口说明文档及打印示例程序 - 20161007
- 关于指针的一些说明int*p=NULL等
- 关于《程序语言-平台优越性》一文补充说明
- 面试题: 看下面的程序是否有问题 如果有问题请指出 并说明 (关于数据类型-隐性转换的小陷阱)
- 关于STM32F405单片机控制传感器BMI160程序及说明
- 关于XAMPP环境下PHP执行外部程序的一些说明
- 程序functionLua基础 小结(两个Lua程序示例)
- 关于typedef,指针数组和数组指针,指针函数的说明
- 关于文词分析的程序说明
- 关于JWFD引用的JGRAPH基础包的问题说明
- 关于移动渐近线优化算法(MMA)的程序说明
- 程序语言基础知识:Java引用与C指针的区别
- 关于android示例程序(bitmapfun)——高效加载图片的缺陷
- 七十七、基础框架(三十五)内存管理-一个关于自动释放池的示例
- 关于使用Spring和hibernate开发web程序的配置说明和简单实例的详细说明
- (转)实战Memcached缓存系统(1)Memcached基础及示例程序
- 一个“无聊”的关于指针的演示程序