vault backup: 2024-09-11 12:41:34

This commit is contained in:
zleyyij 2024-09-11 12:41:34 -06:00
parent 5306277700
commit b33cd35a44

View File

@ -72,4 +72,13 @@ printf("You input: %f", v);
### Behavior ### Behavior
The validity of a `scanf` call is not necessarily checked at compile time, and so the number of outputs specified should match the number of inputs. The validity of a `scanf` call is not necessarily checked at compile time, and so the number of outputs specified should match the number of inputs.
For each formatting specifier specified in the string, `scanf` will attempt to locate an appropriate value in the input, skipping whitespace and newlines if necessary. As `scanf` For each formatting specifier specified in the string, `scanf` will attempt to locate an appropriate value in the input, skipping whitespace and newlines if necessary until the beginning of a number is reached.
When asked to read an integer, `scanf` searches for one of:
- A digit
- A plus or minus sign
It will continue to read until it reaches a nondigit (whitespace is not skipped in this case, and it is counted as a nondigit). If it doesn't encounter a valid digit first, it will return early.
When asked to read a float, `scanf` searches for one of:
- A plus sign or minus sign
- A series of digits (possibly containing a decimal point), followed by an exponent (optional). An exponent consists of the letter `e` or `E`