Answers to questions on input in C

  1. Why is it less importent to define multiple format specifiers for input of floating point numbers, compared with output specifiers?
    The underlying input functions can determine which of the alternatives have been used, without needing to know how many decimal places there are for instance. It is important to know what variant of float or double the value is to be stored into, however.

  2. How could the following be written more concisely?
    scanf("%d",&i);
    c = getchar;
    scanf("%d",&j);
    
    scanf("%d%c%d",&i,&c,&j);

Back to the questions.


Back to notes on input in C.