vault backup: 2024-09-11 12:36:34
This commit is contained in:
parent
3aeeb9dac8
commit
5306277700
@ -57,7 +57,19 @@ Read value(s) from stdin.
|
||||
`scanf` is to stdin as `printf` is to stdout.
|
||||
|
||||
The format of the input is specified using [formatting specifiers](#Formatting%20specifiers), and all following arguments are pointers pointing to variables to update.
|
||||
|
||||
|
||||
### Examples
|
||||
```c
|
||||
// Read a float from standard input into the variable `v`.
|
||||
float v;
|
||||
// Here, `v` is uninitialized
|
||||
scanf("%f", &v);
|
||||
|
||||
printf("You input: %f", v);
|
||||
```
|
||||
|
||||
### 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.
|
||||
|
||||
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`
|
Loading…
Reference in New Issue
Block a user