If I didn't have access to the internet, but knew that I wanted to use the scanf_s()
function to take input from the keyboard (stdin
), how would I know where to declare the buffer?
At the moment, when I step into the scanf_s()
function in Visual Studio, I see this:
#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
;
So, I can see that scanf_s()
takes 1 defined argument (char const * _Format
) which, in this case, could be some placeholder such as be "%s"
, but nothing for the second argument - the memory address of the buffer to store the result of the scanning.