c - 在 scanf 中传递但不在 printf 中传递的地址

标签 c printf scanf

<分区>

Possible Duplicate:
Why scanf must take the address of operator

为什么我们在 printf() 的情况下传递变量,而在 scanf() 的情况下传递变量的地址? 为什么在scanf中传递地址

最佳答案

why to use '&' in scanf( ) but not in printf( )

'printf'()' only need the values in order to output them. 'scanf()' stores values, so it needs a place to store them. This is done by providing the addresses (in pointers) of where to store the values.

关于c - 在 scanf 中传递但不在 printf 中传递的地址,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12102753/

相关文章:

C: scanf() 接受的参数多于应有的参数

c - 如何使用 recv 接收长文本字符串

c - 遍历C中的目录

C printf %d 带有前导零的错误值?

使用 printf 作为变量转换打印数字

bash - 如何在 Bash 中左对齐文本

c - While循环导致程序崩溃

c - 程序进入无限循环而不是调用函数?

c - 用指向数组的指针填充数组

c# - 我如何将此加密从 C# 转换为 C