Solutions to Scanf errors in C language and analysis reasons

Using scanf code directly in C will report an error

Changing scanf to scanf_s will not report an error and can run normally

But scanf_s is not provided by C language, but by VC compiler

This modification would make the code not cross-platform/portable

Adding this paragraph at the beginning of the project can solve this problem

PS: Definitely! must! To be added on the first line!

Guess you like

Origin blog.csdn.net/m0_58307705/article/details/118468068