From 1aab5e8e9c0c69df9c97498ab856edd785c835e1 Mon Sep 17 00:00:00 2001 From: zleyyij <75810274+zleyyij@users.noreply.github.com> Date: Wed, 11 Sep 2024 12:21:34 -0600 Subject: [PATCH] vault backup: 2024-09-11 12:21:34 --- education/software development/ECE1400/C.md | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/education/software development/ECE1400/C.md b/education/software development/ECE1400/C.md index 8687542..e9f4445 100644 --- a/education/software development/ECE1400/C.md +++ b/education/software development/ECE1400/C.md @@ -27,10 +27,13 @@ A variable must be declared before it is assigned. # Formatting specifiers -| Specifier | Function | -| --------- | ---------------------------------------------------------------------------------------------------------------------------------------- | -| `%d` | Display an integer | -| `%f` | Display a float. Specify the number of places to round to by adding a decimal and a number, eg `%.2f` would round to two decimal places. | +# Standard library +## Formatting specifiers +| Specifier | Function | +| --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `%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` | | For number formatting specifiers, the convention is as follows: `%-a.bX` `%`: Start of the formatting specifier @@ -38,5 +41,6 @@ For number formatting specifiers, the convention is as follows: `a`: (optional) If included, the size of the field in characters. `.`: Separator between `a` and `b`. Optional if `b` is not specified `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 -# Standard library \ No newline at end of file +`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