如何存储变量的地址并使用指针打印值

How do i store the address of a variable and print the value using pointers

本文关键字:指针 打印 地址 何存储 存储 变量      更新时间:2023-10-16

例如,如果我有一个变量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 中的关于指针等的好教程。