From 53062777005f267759c928cdf972b265e7be5d08 Mon Sep 17 00:00:00 2001 From: zleyyij <75810274+zleyyij@users.noreply.github.com> Date: Wed, 11 Sep 2024 12:36:34 -0600 Subject: [PATCH] vault backup: 2024-09-11 12:36:34 --- education/software development/ECE1400/C.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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