diff --git a/education/software development/ECE1400/C.md b/education/software development/ECE1400/C.md index a6b82c4..5feb293 100644 --- a/education/software development/ECE1400/C.md +++ b/education/software development/ECE1400/C.md @@ -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); +``` -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. \ No newline at end of file +### 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` \ No newline at end of file