如果我无法访问互联网,但知道我想使用该scanf_s()
函数从键盘 ( stdin
) 获取输入,我怎么知道在哪里声明缓冲区?
目前,当我进入scanf_s()
Visual Studio 中的函数时,我看到了:
#if __STDC_WANT_SECURE_LIB__
_Check_return_opt_
_CRT_STDIO_INLINE int __CRTDECL scanf_s(
_In_z_ _Scanf_s_format_string_ char const* const _Format,
...)
#if defined _NO_CRT_STDIO_INLINE // SCANF
;
所以,我可以看到它scanf_s()
需要 1 个已定义的参数 ( char const * _Format
),在这种情况下,它可能是一些占位符,例如 be "%s"
,但第二个参数没有任何内容 - 用于存储扫描结果的缓冲区的内存地址。