c - 以下句子中的 "for each value converted"是什么意思?

标签 c

下面句子中“for each value converted”是什么意思?

Q: Why doesn't the call scanf("%d", i) work?

A: The arguments you pass to scanf must always be pointers: for each value converted, scanf "returns" it by filling in one of the locations you've passed pointers to. (See also question 20.1.) To fix the fragment above, change it to scanf("%d", &i) .

我在 c-faq 中找到了这个;这是question 12.12 .

最佳答案

如果您执行 scanf("%d", &i) 并输入 123,字符序列 123转换int 值,存储在 i 中。

这不是可能由强制转换指定的类型转换,但将其称为“转换”仍然是合理的。

关于c - 以下句子中的 "for each value converted"是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15911249/

相关文章:

c - 输入 : a2b3c4 and Output: aabbbcccc

c - 信号处理程序是否需要包含在流程中的每个可能上下文中?

通过内联汇编访问系统时间后出现 C 段错误

c - 在c中制作具有特定宽度和高度的钻石(gnuplot)

c - execvp 如何运行命令?

c - 具有自己的文件偏移量的重复文件描述符

c - 变量声明的行为如何?

C mktime() 打印问题

c - 怎么把负数变成正数

c - 了解 Unix dup2 系统调用?