如何存储变量的地址并使用指针打印值
How do i store the address of a variable and print the value using pointers
例如,如果我有一个变量i = 1。如何使用指针存储其地址?用户将输入变量的地址,然后程序将返回变量,例如:例如,int i = 1地址为221122,然后用户输入221122,返回的值应为1。c 是语言
int i;
int *p;
p=&i;
now *p will give you the content in that address.
假设您正在使用C或C ,则可以使用&
操作员。
int num;
int* addrOfNum = #
这是C 中的关于指针等的好教程。
相关文章:
- 为什么我的函数无法使用指针打印多维数组的元素?
- 对象指针打印结果以相反的顺序进行
- 使用指针打印链表中的节点
- 从指针打印动态int阵列中获取怪异的字符
- 通过尾指针打印节点的钥匙
- 如何使用箭头指针打印出一类数组对象,这些对象中有多个分数
- 如何存储变量的地址并使用指针打印值
- 如何用指针打印一系列字符
- 如何通过指针打印 2D 阵列?C++
- 使用指向列表的指针打印列表
- 如果根本不使用单个取消引用运算符,指向指针的指针打印什么值
- 使用指向字符的指针打印字符数组
- 如何在C++中从一组对象指针打印
- 当用另一个指针打印时,同一指针会给出不同的地址
- 如何使用指针的指针打印姓名列表?
- 用指针打印二进制搜索树C++的奇怪方法
- 通过指针打印矩阵
- 为什么即使在调试版本中,VS 和 Windbg 也会"this"指针打印为"0xcccccccc"?
- 使用for循环和指针打印浮点数组
- 无法使用指针打印 2D 矩阵的值