问题描述:利用指针模拟密码开锁
源代码:
/*利用指针模拟密码开锁*/
#include<stdio.h>
int main(void)
{
int x=5342;
int *p=NULL;
p=&x;
/*通过变量x输出密码值*/
printf("通过变量x输出密码值:%d\n",x);
printf("通过变量的地址%x输出密码值:%d\n",p,*p);
return 0;
}
运行结果:

程序心得:
1、%x 输出十六进制数字。
2、p=&x;//将变量x的地址存储在p中
程序参数:
- 输出大小: 148.1923828125 KiB
- 编译时间: 0.30s
网友评论