c++ scanf读取_使用scanf()读取内存地址并在C中打印其值

该博客介绍了如何在C++中使用scanf函数读取内存地址,并打印存储在该地址上的值。通过示例程序,解释了如何声明一个变量,获取其内存地址,然后从用户那里读取并打印内存地址对应的值。
摘要由CSDN通过智能技术生成

c++ scanf读取

Here, we have to input a valid memory address and print the value stored at memory address in C.

在这里,我们必须输入一个有效的内存地址并在C中打印存储在内存地址中的值。

To input and print a memory address, we use "%p" format specifier – which can be understood as "pointer format specifier".

要输入和打印内存地址,我们使用“%p”格式说明符-可以理解为“指针格式说明符”

Program:

程序:

In this program - first, we are declaring a variable named num and assigning any value in it. Since we cannot predict a valid memory address. So here, we will print the memory address of num and then, we will read it from the user and print its value.

在此程序中-首先,我们声明一个名为num的变量,并在其中分配任何值。 由于我们无法预测有效

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值