From 46132a5bcd6dbe22be96db63808d8021ae0a2a24 Mon Sep 17 00:00:00 2001 From: zleyyij <75810274+zleyyij@users.noreply.github.com> Date: Wed, 11 Sep 2024 12:26:34 -0600 Subject: [PATCH] vault backup: 2024-09-11 12:26:34 --- education/software development/ECE1400/C.md | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/education/software development/ECE1400/C.md b/education/software development/ECE1400/C.md index e9f4445..48709bb 100644 --- a/education/software development/ECE1400/C.md +++ b/education/software development/ECE1400/C.md @@ -33,7 +33,8 @@ A variable must be declared before it is assigned. | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | | `%d` | Decimal representation: Display a value as a base 10 (hence the decimal) integer. | | `%f` | Fixed point decimal representation. Specify the number of places to round to by adding a decimal and a number, eg `%.2f` would round to two decimal places. | -| `%e` | | +| `%e` | Exponential floating point number representation. | +| `%g` | Either fixed point or exponential representation, whichever has a more compact representation. | For number formatting specifiers, the convention is as follows: `%-a.bX` `%`: Start of the formatting specifier @@ -43,4 +44,15 @@ For number formatting specifiers, the convention is as follows: `b`: The number of decimal places to round to `X`: The type of format to use, and the end of the specifier. Use `d` for integer base 10 (decimal) representation, `f` for fixed point decimal, and `e` for exponential notation, and `g` to select between fixed point and exponential, whichever is shorter. ## `printf` -Write a string to standard output. `f` indicates that it's a formatting string. The string will not include move the cursor to a newline, append `\n` to the end of the string to do so. \ No newline at end of file +Used to write a string to stdout with the ability to format variables into the string. + +Write a string to standard output. `f` indicates that it's a formatting string. The string will not include move the cursor to a newline, append `\n` to the end of the string to do so. + +Printf accepts a variable number of arguments, the first argument is the formatting string, then following arguments are the arguments to be inserted into the string. + +## `scanf` +Read value(s) from stdin. + +`scanf` is to stdin as `printf` is to stdout. + +The format of the input is specified \ No newline at end of file