+ 1

What is the difference between "scanf" and "scanf_s" in C ?

scanf_s is recommended in VS-2017 after i used the regular scanf https://code.sololearn.com/cx3Xheh5P2Gz/?ref=app

16th Nov 2018, 12:29 AM
B15
B15 - avatar
2 Answers
+ 2
scanf_s() is a more secure version of scanf(). After the argument specifying the destination, the size of the destination must be provided. The program checks that the buffer is of the specified size before copying it to ensure that that there are no overwrites and malicious code isn't run.
16th Nov 2018, 12:54 AM
AL Araf
AL Araf - avatar
0
Why doesn't it work on play ground ?
16th Nov 2018, 1:04 AM
B15
B15 - avatar