From 9e902af312060219fab97cb652089cf71db68a79 Mon Sep 17 00:00:00 2001 From: Joshua Potter Date: Tue, 13 Feb 2024 13:06:24 -0700 Subject: [PATCH] Notes on binary shifts and printf formatting. --- .../plugins/obsidian-to-anki-plugin/data.json | 13 +- notes/_journal/2024-02-13.md | 10 +- notes/binary/hexadecimal.md | 63 ------ notes/binary/index.md | 37 ++++ notes/binary/shifts.md | 161 ++++++++++++++ notes/c/declarations.md | 16 ++ notes/c/strings.md | 207 +++++++++++++++++- 7 files changed, 434 insertions(+), 73 deletions(-) create mode 100644 notes/binary/shifts.md diff --git a/notes/.obsidian/plugins/obsidian-to-anki-plugin/data.json b/notes/.obsidian/plugins/obsidian-to-anki-plugin/data.json index bddb41b..6cc0c80 100644 --- a/notes/.obsidian/plugins/obsidian-to-anki-plugin/data.json +++ b/notes/.obsidian/plugins/obsidian-to-anki-plugin/data.json @@ -123,12 +123,12 @@ "_journal/2024-02-08.md": "19092bdfe378f31e2774f20d6afbfbac", "algorithms/sorting/selection-sort.md": "73a077a726afd376650d1bd9e2d0bed9", "algorithms/index 1.md": "6fada1f3d5d3af64687719eb465a5b97", - "binary/hexadecimal.md": "813512cb38700a8cb8ecf8ee9d6c9343", - "binary/index.md": "ecb99ff4935e17317bf51f3ba45c1e41", + "binary/hexadecimal.md": "033246347c06b6911ea497ce6da25263", + "binary/index.md": "3c672f105d6a98b21f66547d0731c1ab", "_journal/2024-02-09.md": "a798d35f0b2bd1da130f7ac766166109", "c/types.md": "cf3e66e5aee58a94db3fdf0783908555", "logic/quantification.md": "37655276de8da531ca2b12706a639224", - "c/declarations.md": "ed6ed90493215546b4b181933e0d6004", + "c/declarations.md": "defa26963137a85c2b66d7be733a7815", "algorithms/sorting/bubble-sort.md": "16dad1016dc6555163e42ba20f1d152d", "_journal/2024-02-10.md": "562b01f60ea36a3c78181e39b1c02b9f", "_journal/2024-01/2024-01-31.md": "7c7fbfccabc316f9e676826bf8dfe970", @@ -149,12 +149,13 @@ "_journal/2024-02/2024-02-11.md": "afee9f502b61e17de231cf2f824fbb32", "encoding/ascii.md": "c01e50f96d0493d94dc4d520c0b6bb71", "encoding/index.md": "071cfa6a5152efeda127b684f420d438", - "c/strings.md": "38f9cf9e2325565589f62e191221a83a", + "c/strings.md": "1956bbfd6af40655f945621e4c14fd43", "logic/truth-tables.md": "7892ceaa416c9a65acc79ca1e6ff778f", "logic/short-circuit.md": "26d300f407f14883022d0ef8dc4f7300", "logic/boolean-algebra.md": "c5d699d407e03d280aa1f201bc3e8b02", - "_journal/2024-02-13.md": "75ba5d7d77862c50a172a59415ec6a84", - "_journal/2024-02/2024-02-12.md": "618c0035a69b48227119379236a02f44" + "_journal/2024-02-13.md": "ed5e2692c31226489d1115d301c660ef", + "_journal/2024-02/2024-02-12.md": "618c0035a69b48227119379236a02f44", + "binary/shifts.md": "c9237b5b949519694ab55deb9b740bd1" }, "fields_dict": { "Basic": [ diff --git a/notes/_journal/2024-02-13.md b/notes/_journal/2024-02-13.md index 7fe40b9..42ca46d 100644 --- a/notes/_journal/2024-02-13.md +++ b/notes/_journal/2024-02-13.md @@ -4,10 +4,14 @@ title: "2024-02-13" - [x] Anki Flashcards - [x] KoL -- [ ] Sheet Music (10 min.) +- [x] Sheet Music (10 min.) - [ ] OGS (1 Life & Death Problem) -- [ ] Korean (Read 1 Story) +- [x] Korean (Read 1 Story) - [ ] Interview Prep (1 Practice Problem) - [ ] Log Work Hours (Max 3 hours) -* Read more on record and field separators in `gawk`. \ No newline at end of file +* Read more on record and field separators in `gawk`. +* Copied over my bash and neovim configs onto my desktop. +* Continued practicing One Summer's Day. +* Read 혹부리 할아버지 (The Old Man with the Lump). +* Begin adding notes/flashcards on `printf`. It's format specifier is used in enough places to warrant it. \ No newline at end of file diff --git a/notes/binary/hexadecimal.md b/notes/binary/hexadecimal.md index 3ed6143..1805cc0 100644 --- a/notes/binary/hexadecimal.md +++ b/notes/binary/hexadecimal.md @@ -11,27 +11,6 @@ tags: Hexadecimal encoding refers to the 16-base representation of binary numbers. Distinguish potentially ambiguous values like $32$ with the base as a subscript, e.g. $32_{10}$ vs $32_{16}$. -%%ANKI -Cloze -A byte consists of {8} bits. -Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. - -END%% - -%%ANKI -Cloze -A byte consists of {2} nibbles. -Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. - -END%% - -%%ANKI -Cloze -A nibble consists of {4} bits. -Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. - -END%% - %%ANKI Cloze A byte consists of {2} hexadecimal digits. @@ -92,32 +71,6 @@ Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Program END%% -%%ANKI -Basic -How is $2^n$ written in binary? -Back: As `1` followed by $n$ zeros. -Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. - -END%% - -%%ANKI -Basic -How is $2^n$ written using bitwise shift operators? -Back: `1 << n` -Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. -Tag: c - -END%% - -%%ANKI -Basic -What decimal value does `1 << n` translate to? -Back: $2^n$ -Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. -Tag: c - -END%% - %%ANKI Basic What are the possible hex values the first digit of $2^n$ can take on? @@ -182,22 +135,6 @@ Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Program END%% -%%ANKI -Basic -What process is used to convert from e.g. decimal to another base? -Back: Divide repeatedly by the base. Maintain remainders right to left. -Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. - -END%% - -%%ANKI -Basic -Why does converting from e.g. decimal to another base involve repeated division? -Back: The position of a digit corresponds to the base raised to the position. -Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. - -END%% - %%ANKI Basic How is the *remainder* of e.g. `158 / 16` managed in decimal to hex conversion? diff --git a/notes/binary/index.md b/notes/binary/index.md index c61ca01..388c07f 100644 --- a/notes/binary/index.md +++ b/notes/binary/index.md @@ -3,3 +3,40 @@ title: Binary tags: - binary --- + +%%ANKI +Cloze +A byte consists of {8} bits. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Cloze +A byte consists of {2} nibbles. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Cloze +A nibble consists of {4} bits. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +What process is used to convert from e.g. decimal to another base? +Back: Divide repeatedly by the base. Maintain remainders right to left. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +Why does converting from e.g. decimal to another base involve repeated division? +Back: The position of a digit corresponds to the base raised to the position. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% \ No newline at end of file diff --git a/notes/binary/shifts.md b/notes/binary/shifts.md new file mode 100644 index 0000000..415adfa --- /dev/null +++ b/notes/binary/shifts.md @@ -0,0 +1,161 @@ +--- +title: Shifts +TARGET DECK: Obsidian::STEM +FILE TAGS: binary +tags: + - binary +--- + +## Overview + +Left shift operations (`<<`) drop the `k` most significant bits and fills the right end of the result with `k` zeros. Right shift operations (`>>`) are classified in two ways: + +* **Logical** + * Drops the `k` least significant bits and fills the left end of the result with `k` zeros. + * This mode is always used when calling `>>` on unsigned data. + * Sometimes denoted as `>>>` to disambiguate from arithmetic right shifts. +* **Arithmetic** + * Drops the `k` least significant bits and fills the left end of the result with `k` copies of the most significant bit. + * This mode is usually used when calling `>>` on signed data. + +%%ANKI +Basic +How is $2^n$ written in binary? +Back: As `1` followed by $n$ zeros. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +How is $2^n$ written using bitwise shift operators? +Back: `1 << n` +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. +Tag: c + +END%% + +%%ANKI +Basic +What decimal value does `1 << n` translate to? +Back: $2^n$ +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. +Tag: c + +END%% + +%%ANKI +Basic +What kinds of left shift operations are there? +Back: Just logical. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +How many most significant bits are dropped on a left shift by `k` (e.g. `<< k`)? +Back: `k` +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. +Tags: c + +END%% + +%%ANKI +Basic +How many zeros exist in the result of a left shift by `k` (e.g. `<< k`)? +Back: At least `k`. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. +Tags: c + +END%% + +%%ANKI +Basic +What kinds of right shift operations are there? +Back: Logical and arithmetic +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +What is a logical right shift operation? +Back: One that fills the left end of the result with `k` zeros. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +What is an arithmetic right shift operation? +Back: One that fills the left end of the result with `k` copies of the most significant bit. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +How many least significant bits are dropped on a right shift by `k` (e.g. `>> k`)? +Back: `k` +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. +Tags: c + +END%% + +%%ANKI +Basic +How many zeros exist in the result of a logical right shift by `k` (e.g. `>> k`)? +Back: At least `k`. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. +Tags: c + +END%% + +%%ANKI +Basic +How many zeros exist in the result of an arithmetic right shift by `k` (e.g. `>> k`)? +Back: Zero or more. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. +Tags: c + +END%% + +%%ANKI +Basic +What kind of right shift operation is *usually* applied to signed numbers? +Back: Arithmetic. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. +Tags: c + +END%% + +%%ANKI +Basic +What kind of right shift operation is applied to unsigned numbers? +Back: Logical. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. +Tags: c + +END%% + +%%ANKI +Basic +What portability issue do shift operations introduce? +Back: There is no standard on whether right shifts of signed numbers are logical or arithmetic. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. +Tags: c + +END%% + +%%ANKI +Cloze +{Arithmetic} right shifts are to {signed} numbers whereas {logical} right shifts are to {unsigned} numbers. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. +Tags: c + +END%% + +## References + +* Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. \ No newline at end of file diff --git a/notes/c/declarations.md b/notes/c/declarations.md index d570411..deb561b 100644 --- a/notes/c/declarations.md +++ b/notes/c/declarations.md @@ -17,6 +17,22 @@ long | unsigned long | 4 | 8 char * | - | 4 | 8 float | - | 4 | 4 double | - | 8 | 8 +Fixed width data integral types (e.g. `int32_t`) can be found by including ``. + +%%ANKI +Cloze +The {``} header file contains {fixed width data integral types}. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +What does the "width" of an integer type refer to? +Back: The number of bits used to represent its value. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% %%ANKI What two variants does a C integral type declaration have? diff --git a/notes/c/strings.md b/notes/c/strings.md index 43979a4..45c9a64 100644 --- a/notes/c/strings.md +++ b/notes/c/strings.md @@ -42,6 +42,211 @@ Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Program END%% +## `printf` + +The syntax for the format placeholder is `%[param][flags][width][.precision][length]specifier`. + +Specifier | Description +--------- | ----------- +`d`, `i` | a decimal `signed int` +`u` | a decimal `unsigned int` +`x` | a hexadecimal `unsigned int` (lowercase) +`X` | a hexadecimal `unsigned int` (uppercase) +`o` | an octal `unsigned int` +`s` | a `NUL`-terminated string +`c` | a `char` character +`p` | `void*` address in an implementation-defined format + +%%ANKI +Basic +What character do `printf` format specifiers start with? +Back: `%` +Reference: “Printf,” in *Wikipedia*, January 18, 2024, [https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962](https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962). +Tags: printf + +END%% + +%%ANKI +Basic +Why is `printf` named the way it is? +Back: It stands for **print f**ormatted. +Reference: “Printf,” in *Wikipedia*, January 18, 2024, [https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962](https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962). +Tags: printf + +END%% + +%%ANKI +Cloze +The {`d` and `i`} format specifer(s) output a(n) {decimal `signed int`}. +Reference: “Printf,” in *Wikipedia*, January 18, 2024, [https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962](https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962). +Tags: printf + +END%% + +%%ANKI +Cloze +{`d` and `i`} are to `signed` as {`u`} is to `unsigned`. +Reference: “Printf,” in *Wikipedia*, January 18, 2024, [https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962](https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962). +Tags: printf + +END%% + +%%ANKI +Cloze +The {`u`} format specifier(s) output a(n) {decimal `unsigned int`}. +Reference: “Printf,” in *Wikipedia*, January 18, 2024, [https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962](https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962). +Tags: printf + +END%% + +%%ANKI +Basic +What distinguishes format specifiers `d` and `i`? +Back: Nothing. +Reference: “Printf,” in *Wikipedia*, January 18, 2024, [https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962](https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962). +Tags: printf + +END%% + +%%ANKI +Basic +Which format specifier(s) were probably used to yield `printf` output `-12`? +Back: `d` or `i` +Reference: “Printf,” in *Wikipedia*, January 18, 2024, [https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962](https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962). +Tags: printf + +END%% + +%%ANKI +Basic +What distinguishes format specifiers `d` and `u`? +Back: The former is for signed integers, the latter unsigned. +Reference: “Printf,” in *Wikipedia*, January 18, 2024, [https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962](https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962). +Tags: printf + +END%% + +%%ANKI +Cloze +The {`x`} format specifier(s) output a(n) {lowercase hexadecimal `unsigned int`}. +Reference: “Printf,” in *Wikipedia*, January 18, 2024, [https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962](https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962). +Tags: printf + +END%% + +%%ANKI +Basic +Which format specifier(s) were probably used to yield `printf` output `7af`? +Back: `x` +Reference: “Printf,” in *Wikipedia*, January 18, 2024, [https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962](https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962). +Tags: printf + +END%% + +%%ANKI +Cloze +The {`X`} format specifier(s) output a(n) {uppercase hexadecimal `unsigned int`}. +Reference: “Printf,” in *Wikipedia*, January 18, 2024, [https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962](https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962). +Tags: printf + +END%% + +%%ANKI +Basic +Which format specifier(s) were probably used to yield `printf` output `7AF`? +Back: `X` +Reference: “Printf,” in *Wikipedia*, January 18, 2024, [https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962](https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962). +Tags: printf + +END%% + +%%ANKI +Basic +What distinguishes format specifiers `x` and `X`? +Back: The former outputs lowercase hex digits, the latter uppercase. +Reference: “Printf,” in *Wikipedia*, January 18, 2024, [https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962](https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962). +Tags: printf + +END%% + +%%ANKI +Cloze +The {`o`} format specifier(s) output a(n) {octal `unsigned int`}. +Reference: “Printf,” in *Wikipedia*, January 18, 2024, [https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962](https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962). +Tags: printf + +END%% + +%%ANKI +Basic +Why doesn't the `o` format specifier have a corresponding `O` specifier? +Back: There is no distinction between lower and uppercase octal digits. +Reference: “Printf,” in *Wikipedia*, January 18, 2024, [https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962](https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962). +Tags: printf + +END%% + +%%ANKI +Cloze +The {`s`} format specifier(s) output a(n) {`NUL`-terminated string}. +Reference: “Printf,” in *Wikipedia*, January 18, 2024, [https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962](https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962). +Tags: printf + +END%% + +%%ANKI +Basic +Which format specifier(s) were probably used to yield `printf` output `abc`? +Back: `s` +Reference: “Printf,” in *Wikipedia*, January 18, 2024, [https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962](https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962). +Tags: printf + +END%% + +%%ANKI +Cloze +The {`c`} format specifier(s) output a(n) {`char` character}. +Reference: “Printf,” in *Wikipedia*, January 18, 2024, [https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962](https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962). +Tags: printf + +END%% + +%%ANKI +Basic +Which format specifier(s) were probably used to yield `printf` output `a`? +Back: `c` +Reference: “Printf,” in *Wikipedia*, January 18, 2024, [https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962](https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962). +Tags: printf + +END%% + +%%ANKI +Cloze +The {`p`} format specifier(s) output a(n) {`void*` address}. +Reference: “Printf,” in *Wikipedia*, January 18, 2024, [https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962](https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962). +Tags: printf + +END%% + +%%ANKI +Basic +Which format specifier(s) were probably used to yield `printf` output `0b80000000`? +Back: `p` +Reference: “Printf,” in *Wikipedia*, January 18, 2024, [https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962](https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962). +Tags: printf + +END%% + +%%ANKI +Basic +How is the address outputted by the `p` format specifier written? +Back: In an implementation-specific way. +Reference: “Printf,” in *Wikipedia*, January 18, 2024, [https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962](https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962). +Tags: printf + +END%% + ## References -* Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. \ No newline at end of file +* Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. +* “Printf,” in *Wikipedia*, January 18, 2024, [https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962](https://en.wikipedia.org/w/index.php?title=Printf&oldid=1196716962).