当前位置:网站首页>vs2022scanf函数的使用,使用scanf的报错-返回值被忽略:解决·方法
vs2022scanf函数的使用,使用scanf的报错-返回值被忽略:解决·方法
2022-06-23 18:42:00 【51CTO】
scanf()是C语言的格式输入函数,和printf函数一样被声名在studo.h的头文件中,在这里使用到了scanf函数,简单的求和例子,如下
在当前程序的第七行,我们就用到了scanf函数了,接下来就等待用户的输入,它接受的是变量的地址,所以在一般情况下除了指针型变量和数组名的时候一定要加上&。不要忘了&,不要忘了&,不要忘了&!!!
scanf的调用格式(“”,);
运行后按一下方式输出num1,mum2的值
本该是正常的流程
但是
报错:“scanf”返回值被忽略
在网上搜了下,成功解决
需要在整个代码前面加上
define _CRT_SECURE_NO_WARNINGS
成功运行,以下是成功实例
细心的同学会发现我用的是“scanf_s”函数,而不是"scanf"
是因为返回值被忽略scanf是因代码中没有使用scanf的返回值,需要用scanf_s函数来代替scanf,scanf是C语言提供的,而scanf_s不是标准C语言提供的,是vs编译器提供的,最后这个程序终于运行了出来。
边栏推荐
- MySQL时间函数的运用,简单问题
- Convex optimization notes
- Deeply understand and grasp the basic characteristics of digital economy
- 官宣.NET 7 预览版5
- 准备好迁移上云了?请收下这份迁移步骤清单
- Uniswap founder: no independent token will be issued for genie, and Genie products will be integrated into the uniswap interface
- 打新债有何要求 打新债安全吗
- Netseer: stream event telemetry notes for programmable data plane
- Principles of microcomputer Chapter 6 notes arrangement
- Ready to migrate to the cloud? Please accept this list of migration steps
猜你喜欢

在线文本实体抽取能力,助力应用解析海量文本数据

Hotline salon issue 26 - cloud security session

火线沙龙第26期-多云安全专场

20省市公布元宇宙路线图

基于 ShardingSphere 的得物数据库中间件平台“彩虹桥”演进之路

Elastricearch's fragmentation principle of the second bullet

如何避免基因领域“黑天鹅”事件:一场预防性“召回”背后的安全保卫战

UST 崩盘后,稳定币市场格局将迎来新机遇?

NAACL 2022 Findings | 字节提出MTG:多语言文本生成数据集
![Develop small programs and official account from zero [phase I]](/img/02/77386ba3fe50b16018f77115b99db6.png)
Develop small programs and official account from zero [phase I]
随机推荐
QGIS import WMS or WMTs
区块哈希竞猜游戏系统开发(dapp)
What are the useful personnel management software? Personnel management system software ranking!
如何利用数仓创建时序表
盘点四种WiFi加密标准:WEP、WPA、WPA2、WPA3
[one by one series] identityserver4 (VIII) uses entityframework core to persist data
What conditions do you need to meet to fight new debts? Is it safe to fight new debts
技术分享| WVP+ZLMediaKit实现摄像头GB28181推流播放
直播回顾 | 云原生混部系统 Koordinator 架构详解(附完整PPT)
Chaos engineering, learn about it
【One by One系列】IdentityServer4(六)授权码流程原理之SPA
SAP实施项目上的内部顾问与外部顾问,相互为难还是相互成就?
Why is only one value displayed on your data graph?
Check four WiFi encryption standards: WEP, WPA, WPA2 and WPA3
Application of JDBC in performance test
Is it safe to pay new debts
硬件开发笔记(六): 硬件开发基本流程,制作一个USB转RS232的模块(五):创建USB封装库并关联原理图元器件
准备好迁移上云了?请收下这份迁移步骤清单
Various solutions to knapsack problems
Principles of microcomputer Chapter 6 notes arrangement