Other Precautions point C scanf function

 

 

 

1, scanf no precision control function, such as: scanf ( "% 5.2f", & a) is illegal and can not attempt a real number with two decimal places this statement data

 

2, scanf required address given variable, the variable name is given as an error occurs, such as: scanf ( "% d", a); is illegal and should be replaced scanf ( "% d", & a), it It is legal

 

3, a plurality of the input numeric data, the format of the control stream when there is no gap between the non-input data format string may be a space, TAB, or do the transport intervals,

  Recognized both ends when the data in the C compiler encountered illegal data (such as when the input of% d "12A", A is the illegal data)

4, when the input character data, when the format control character string is nothing format, it can be considered that all characters entered were valid character

 

5, if the format control character string in the format of the input non-modified non also input format string

 

6, when the inconsistent data as input data and output, although the compiler can, but the result will be incorrect

 

Guess you like

Origin www.cnblogs.com/jasonLiu2018/p/11521062.html