The main difference between printf_s and printf is that printf_s checks the format string for valid formatting characters, whereas printf only checks if the format string is a null pointer.
MSDN printf_s
So, the difference between printf and printf_s is that printf will only check whether the format string is empty, while printf_s will also check whether the user-defined format string is legal. For example:
The format string given in the second line is problematic, but printf on the third line can still output "Hello world!10", and an error will be reported when the fourth line is executed.
MSDN printf_s
So, the difference between printf and printf_s is that printf will only check whether the format string is empty, while printf_s will also check whether the user-defined format string is legal. For example:
The format string given in the second line is problematic, but printf on the third line can still output "Hello world!10", and an error will be reported when the fourth line is executed.