下面句子中“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 toscanf("%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/