Notes on binary shifts and printf formatting.

c-declarations
Joshua Potter 2024-02-13 13:06:24 -07:00
parent c98a083e23
commit 9e902af312
7 changed files with 434 additions and 73 deletions

View File

@ -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": [

View File

@ -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`.
* 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.

View File

@ -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.
<!--ID: 1707432641557-->
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.
<!--ID: 1707432641560-->
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.
<!--ID: 1707432641562-->
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
<!--ID: 1707432641573-->
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.
<!--ID: 1707432641574-->
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
<!--ID: 1707432641576-->
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
<!--ID: 1707432641577-->
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
<!--ID: 1707432641589-->
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.
<!--ID: 1707432641591-->
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.
<!--ID: 1707432641592-->
END%%
%%ANKI
Basic
How is the *remainder* of e.g. `158 / 16` managed in decimal to hex conversion?

View File

@ -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.
<!--ID: 1707432641557-->
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.
<!--ID: 1707432641560-->
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.
<!--ID: 1707432641562-->
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.
<!--ID: 1707432641591-->
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.
<!--ID: 1707432641592-->
END%%

161
notes/binary/shifts.md Normal file
View File

@ -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.
<!--ID: 1707432641574-->
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
<!--ID: 1707432641576-->
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
<!--ID: 1707432641577-->
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.
<!--ID: 1707854589773-->
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
<!--ID: 1707854589778-->
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
<!--ID: 1707854589781-->
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.
<!--ID: 1707854589784-->
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.
<!--ID: 1707854589786-->
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.
<!--ID: 1707854589789-->
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
<!--ID: 1707854589792-->
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
<!--ID: 1707854589794-->
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
<!--ID: 1707854589797-->
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
<!--ID: 1707854589801-->
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
<!--ID: 1707854589804-->
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
<!--ID: 1707854589808-->
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
<!--ID: 1707854589813-->
END%%
## References
* Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.

View File

@ -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 `<stdint.h>`.
%%ANKI
Cloze
The {`<stdint.h>`} 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.
<!--ID: 1707835869728-->
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.
<!--ID: 1707835869737-->
END%%
%%ANKI
What two variants does a C integral type declaration have?

View File

@ -42,6 +42,211 @@ Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Program
<!--ID: 1707758281270-->
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
<!--ID: 1707852083029-->
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
<!--ID: 1707852083037-->
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
<!--ID: 1707852083040-->
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
<!--ID: 1707852083044-->
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
<!--ID: 1707852083047-->
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
<!--ID: 1707852083050-->
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
<!--ID: 1707852083054-->
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
<!--ID: 1707852083058-->
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
<!--ID: 1707852083063-->
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
<!--ID: 1707852083068-->
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
<!--ID: 1707852083074-->
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
<!--ID: 1707852083080-->
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
<!--ID: 1707852083086-->
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
<!--ID: 1707852083091-->
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
<!--ID: 1707852083096-->
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
<!--ID: 1707852083100-->
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
<!--ID: 1707852083105-->
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
<!--ID: 1707852083109-->
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
<!--ID: 1707852083113-->
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
<!--ID: 1707852083117-->
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
<!--ID: 1707852083121-->
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
<!--ID: 1707852083126-->
END%%
## References
* Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
* 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).