Scanf_S always reports errors [How to Solve]

First let me make complaints about it.

scanf_s. You really wasted a lot of my time

At first I was going to use scanf_S when inputting floating-point data and character data, the system always reports an error, that is, there is no error in the generation solution, but debugging is not good, eh, it is not good.

That’s it. I didn’t know at first. I thought it was a floating point problem. As a result, I haven’t worked it out for a long time,

Later, by chance, I found that it was actually the problem of character data. When I was using scanf_s, the length of character data should be specified, otherwise an error will be reported, but scanf is not used. In other words, the eighth line should be changed in this way

scanf_s("%f%c%f", &a, &op,1, &b);

The specified character length is one.

I’ll check the information and update it.

Read More: