Why does the scanf_s function in Visual Studio 2013 stop using the C language when using "% s"?
char name[40]; scanf_s("%s", name); Then, when I entered the data into the console, I press enter, and I see the message “Termination of work”.
Why does the scanf_s function in Visual Studio 2013 stop using the C language when using "% s"?
char name[40]; scanf_s("%s", name); Then, when I entered the data into the console, I press enter, and I see the message “Termination of work”.
Because scanf_s requires specifying the size of all buffers transferred to it.
scanf_s("%s", name, 40); You must specify the _countof (имя переменной куда считываешь) parameter _countof (имя переменной куда считываешь) , for example:
scanf_s("%s",&name,_countof(name)); _countof type is not the same, you need unsigned transfer. - Qwertiy ♦Source: https://ru.stackoverflow.com/questions/881520/
All Articles