Update from "c" to "c17".
parent
a42ccc880a
commit
92e691e937
|
@ -92,7 +92,7 @@
|
||||||
"bash/shebang.md": "9006547710f9a079a3666169fbeda7aa",
|
"bash/shebang.md": "9006547710f9a079a3666169fbeda7aa",
|
||||||
"c/escape-sequences.md": "7b4bbf159908320249158acfe47a9074",
|
"c/escape-sequences.md": "7b4bbf159908320249158acfe47a9074",
|
||||||
"c/index.md": "a021c92f19831bdd2bca4cbf813882fe",
|
"c/index.md": "a021c92f19831bdd2bca4cbf813882fe",
|
||||||
"gawk/index.md": "dd851e023e11c556c0272a0dcb6dd55d",
|
"gawk/index.md": "e4da41ba6a2c2602d9f15f2930608e3c",
|
||||||
"gawk/variables.md": "73b12bd0d7d6f97b4a7285aaf2c45bfa",
|
"gawk/variables.md": "73b12bd0d7d6f97b4a7285aaf2c45bfa",
|
||||||
"index.md": "e48e895feeed7046425bb2ee15419770",
|
"index.md": "e48e895feeed7046425bb2ee15419770",
|
||||||
"journal/2024-01-31.md": "7c7fbfccabc316f9e676826bf8dfe970",
|
"journal/2024-01-31.md": "7c7fbfccabc316f9e676826bf8dfe970",
|
||||||
|
@ -100,7 +100,7 @@
|
||||||
"journal/2024-02-02.md": "a3b222daee8a50bce4cbac699efc7180",
|
"journal/2024-02-02.md": "a3b222daee8a50bce4cbac699efc7180",
|
||||||
"journal/2024-02-03.md": "c6d411f0e2e964270399dd3a99f48382",
|
"journal/2024-02-03.md": "c6d411f0e2e964270399dd3a99f48382",
|
||||||
"logic/index.md": "46cdc7a552900e99a7d2d0140971118c",
|
"logic/index.md": "46cdc7a552900e99a7d2d0140971118c",
|
||||||
"logic/propositional.md": "c438bdad405832e3c180469e961539cc",
|
"logic/propositional.md": "41e1490c98a249a6d435f896f08a856b",
|
||||||
"lua/index.md": "fd3d0b66765f0e9df233e8e02ce33e94",
|
"lua/index.md": "fd3d0b66765f0e9df233e8e02ce33e94",
|
||||||
"nix/callPackage.md": "140a02e57cd01d646483e3c21d72243d",
|
"nix/callPackage.md": "140a02e57cd01d646483e3c21d72243d",
|
||||||
"nix/index.md": "4efc7fcc4ea22834ba595497e5fb715c",
|
"nix/index.md": "4efc7fcc4ea22834ba595497e5fb715c",
|
||||||
|
@ -118,21 +118,21 @@
|
||||||
"_journal/2024-02-02.md": "a3b222daee8a50bce4cbac699efc7180",
|
"_journal/2024-02-02.md": "a3b222daee8a50bce4cbac699efc7180",
|
||||||
"_journal/2024-02-01.md": "3aa232387d2dc662384976fd116888eb",
|
"_journal/2024-02-01.md": "3aa232387d2dc662384976fd116888eb",
|
||||||
"_journal/2024-01-31.md": "7c7fbfccabc316f9e676826bf8dfe970",
|
"_journal/2024-01-31.md": "7c7fbfccabc316f9e676826bf8dfe970",
|
||||||
"logic/equiv-trans.md": "08ad9c814f0a46981b218a9c7cc8a3b8",
|
"logic/equiv-trans.md": "b22c24a523d2acd4e44083f492c0017b",
|
||||||
"_journal/2024-02-07.md": "8d81cd56a3b33883a7706d32e77b5889",
|
"_journal/2024-02-07.md": "8d81cd56a3b33883a7706d32e77b5889",
|
||||||
"algorithms/loop-invariants.md": "cbefc346842c21a6cce5c5edce451eb2",
|
"algorithms/loop-invariants.md": "cbefc346842c21a6cce5c5edce451eb2",
|
||||||
"algorithms/loop-invariant.md": "d883dfc997ee28a7a1e24b995377792b",
|
"algorithms/loop-invariant.md": "29f9f9090a3109890d333a78acc18b50",
|
||||||
"algorithms/running-time.md": "5efc0791097d2c996f931c9046c95f65",
|
"algorithms/running-time.md": "5efc0791097d2c996f931c9046c95f65",
|
||||||
"algorithms/order-growth.md": "5fb2e3ccfc3710be7396a37da7c4f162",
|
"algorithms/order-growth.md": "5fb2e3ccfc3710be7396a37da7c4f162",
|
||||||
"_journal/2024-02-08.md": "19092bdfe378f31e2774f20d6afbfbac",
|
"_journal/2024-02-08.md": "19092bdfe378f31e2774f20d6afbfbac",
|
||||||
"algorithms/sorting/selection-sort.md": "fcd0dc2ebaabd0a4db1baf7e7ef9f7a9",
|
"algorithms/sorting/selection-sort.md": "fcd0dc2ebaabd0a4db1baf7e7ef9f7a9",
|
||||||
"algorithms/index 1.md": "6fada1f3d5d3af64687719eb465a5b97",
|
"algorithms/index 1.md": "6fada1f3d5d3af64687719eb465a5b97",
|
||||||
"binary/hexadecimal.md": "c3d485f1fd869fe600334ecbef7d5d70",
|
"binary/hexadecimal.md": "c3d485f1fd869fe600334ecbef7d5d70",
|
||||||
"binary/index.md": "d97bddf94227df5903a2929febf25606",
|
"binary/index.md": "9089c6f0e86a0727cd03984f51350de0",
|
||||||
"_journal/2024-02-09.md": "a798d35f0b2bd1da130f7ac766166109",
|
"_journal/2024-02-09.md": "a798d35f0b2bd1da130f7ac766166109",
|
||||||
"c/types.md": "cf3e66e5aee58a94db3fdf0783908555",
|
"c/types.md": "cf3e66e5aee58a94db3fdf0783908555",
|
||||||
"logic/quantification.md": "5d7579a511e9ff683edeec62bcc291b8",
|
"logic/quantification.md": "5d7579a511e9ff683edeec62bcc291b8",
|
||||||
"c/declarations.md": "94c85cb1a09efed2cad6b5b80e9d0be3",
|
"c/declarations.md": "2de27f565d1020819008ae80593af435",
|
||||||
"algorithms/sorting/bubble-sort.md": "16dad1016dc6555163e42ba20f1d152d",
|
"algorithms/sorting/bubble-sort.md": "16dad1016dc6555163e42ba20f1d152d",
|
||||||
"_journal/2024-02-10.md": "562b01f60ea36a3c78181e39b1c02b9f",
|
"_journal/2024-02-10.md": "562b01f60ea36a3c78181e39b1c02b9f",
|
||||||
"_journal/2024-01/2024-01-31.md": "7c7fbfccabc316f9e676826bf8dfe970",
|
"_journal/2024-01/2024-01-31.md": "7c7fbfccabc316f9e676826bf8dfe970",
|
||||||
|
@ -147,36 +147,36 @@
|
||||||
"_journal/2024-02/2024-02-01.md": "3aa232387d2dc662384976fd116888eb",
|
"_journal/2024-02/2024-02-01.md": "3aa232387d2dc662384976fd116888eb",
|
||||||
"_journal/2024-02/2024-02-10.md": "562b01f60ea36a3c78181e39b1c02b9f",
|
"_journal/2024-02/2024-02-10.md": "562b01f60ea36a3c78181e39b1c02b9f",
|
||||||
"_journal/2024-02-11.md": "afee9f502b61e17de231cf2f824fbb32",
|
"_journal/2024-02-11.md": "afee9f502b61e17de231cf2f824fbb32",
|
||||||
"binary/endianness.md": "54c86119d0b7fadcc0ee86da2ef5b900",
|
"binary/endianness.md": "1c579ea9106ec6b9c756608118a1f34d",
|
||||||
"logic/normal-form.md": "f8fd5ea205dfb7e331356b0574f0fe14",
|
"logic/normal-form.md": "f8fd5ea205dfb7e331356b0574f0fe14",
|
||||||
"_journal/2024-02-12.md": "240d17f356305de9c0c00282b2931acd",
|
"_journal/2024-02-12.md": "240d17f356305de9c0c00282b2931acd",
|
||||||
"_journal/2024-02/2024-02-11.md": "afee9f502b61e17de231cf2f824fbb32",
|
"_journal/2024-02/2024-02-11.md": "afee9f502b61e17de231cf2f824fbb32",
|
||||||
"encoding/ascii.md": "c01e50f96d0493d94dc4d520c0b6bb71",
|
"encoding/ascii.md": "c01e50f96d0493d94dc4d520c0b6bb71",
|
||||||
"encoding/index.md": "071cfa6a5152efeda127b684f420d438",
|
"encoding/index.md": "071cfa6a5152efeda127b684f420d438",
|
||||||
"c/strings.md": "04b04e2c227e600adb48c74b2dee62b1",
|
"c/strings.md": "aba6e449906d05aee98e3e536eb43742",
|
||||||
"logic/truth-tables.md": "7892ceaa416c9a65acc79ca1e6ff778f",
|
"logic/truth-tables.md": "7892ceaa416c9a65acc79ca1e6ff778f",
|
||||||
"logic/short-circuit.md": "26d300f407f14883022d0ef8dc4f7300",
|
"logic/short-circuit.md": "e088e62ead26779f9a51dfd1caeeb9d4",
|
||||||
"logic/boolean-algebra.md": "f9101b2dfdedb73dc13c34c1a70a0010",
|
"logic/boolean-algebra.md": "00dc2cdc93d6b0e0e60c975ba87f8633",
|
||||||
"_journal/2024-02-13.md": "6242ed4fecabf95df6b45d892fee8eb0",
|
"_journal/2024-02-13.md": "6242ed4fecabf95df6b45d892fee8eb0",
|
||||||
"_journal/2024-02/2024-02-12.md": "618c0035a69b48227119379236a02f44",
|
"_journal/2024-02/2024-02-12.md": "618c0035a69b48227119379236a02f44",
|
||||||
"binary/shifts.md": "ce6f2d80536b8a8b3f05383ce2190e72",
|
"binary/shifts.md": "c2ad95420b3aab03021510d46703ebb2",
|
||||||
"_journal/2024-02-14.md": "76d1b607470305fb3f00a47b8e9ece27",
|
"_journal/2024-02-14.md": "76d1b607470305fb3f00a47b8e9ece27",
|
||||||
"_journal/2024-02/2024-02-13.md": "6242ed4fecabf95df6b45d892fee8eb0",
|
"_journal/2024-02/2024-02-13.md": "6242ed4fecabf95df6b45d892fee8eb0",
|
||||||
"_journal/2024-02-15.md": "575ba46d692795d9606de9e635d1f4ac",
|
"_journal/2024-02-15.md": "575ba46d692795d9606de9e635d1f4ac",
|
||||||
"_journal/2024-02/2024-02-14.md": "aa009f9569e175a8104b0537ebcc5520",
|
"_journal/2024-02/2024-02-14.md": "aa009f9569e175a8104b0537ebcc5520",
|
||||||
"_journal/2024-02-16.md": "5cc129254afd553829be3364facd23db",
|
"_journal/2024-02-16.md": "5cc129254afd553829be3364facd23db",
|
||||||
"_journal/2024-02/2024-02-15.md": "16cb7563d404cb543719b7bb5037aeed",
|
"_journal/2024-02/2024-02-15.md": "16cb7563d404cb543719b7bb5037aeed",
|
||||||
"algebra/floor-ceiling.md": "efc4502ed22128e14b20ba88b368a872",
|
"algebra/floor-ceiling.md": "e9f905f5ec01921e0f19afe8732fb38b",
|
||||||
"algebra/index.md": "90b842eb694938d87c7c68779a5cacd1",
|
"algebra/index.md": "90b842eb694938d87c7c68779a5cacd1",
|
||||||
"algorithms/binary-search.md": "08cb6dc2dfb204a665d8e8333def20ca",
|
"algorithms/binary-search.md": "08cb6dc2dfb204a665d8e8333def20ca",
|
||||||
"_journal/2024-02-17.md": "7c37cb10515ed3d2f5388eaf02a67048",
|
"_journal/2024-02-17.md": "7c37cb10515ed3d2f5388eaf02a67048",
|
||||||
"_journal/2024-02/2024-02-16.md": "e701902e369ec53098fc2deed4ec14fd",
|
"_journal/2024-02/2024-02-16.md": "e701902e369ec53098fc2deed4ec14fd",
|
||||||
"binary/integer-encoding.md": "afe5e82b534fc5ab409b188addab36f4",
|
"binary/integer-encoding.md": "95571264710f244da40c8203ad1de993",
|
||||||
"combinatorics/index.md": "f9de9671fdb6068ef2bb5e63051734be",
|
"combinatorics/index.md": "f9de9671fdb6068ef2bb5e63051734be",
|
||||||
"_journal/2024-02-18.md": "67e36dbbb2cac699d4533b5a2eaeb629",
|
"_journal/2024-02-18.md": "67e36dbbb2cac699d4533b5a2eaeb629",
|
||||||
"_journal/2024-02/2024-02-17.md": "7c37cb10515ed3d2f5388eaf02a67048",
|
"_journal/2024-02/2024-02-17.md": "7c37cb10515ed3d2f5388eaf02a67048",
|
||||||
"combinatorics/multiplicative-principle.md": "3e4f600f5300d3d4d64099b8f2bd1458",
|
"combinatorics/multiplicative-principle.md": "eae60248d68ba8bd2da5e4c3fea70109",
|
||||||
"combinatorics/additive-principle.md": "84dcd0243263b3c53456086ae43fa00f",
|
"combinatorics/additive-principle.md": "e968028670f95ee9a7c5499ff7cb6792",
|
||||||
"_journal/2024-02-19.md": "30d16c5373deb9cb128d2e7934ae256a",
|
"_journal/2024-02-19.md": "30d16c5373deb9cb128d2e7934ae256a",
|
||||||
"_journal/2024-02/2024-02-18.md": "67e36dbbb2cac699d4533b5a2eaeb629",
|
"_journal/2024-02/2024-02-18.md": "67e36dbbb2cac699d4533b5a2eaeb629",
|
||||||
"combinatorics/permutations.md": "606b4b2b8018797ca54857112235d96e",
|
"combinatorics/permutations.md": "606b4b2b8018797ca54857112235d96e",
|
||||||
|
@ -188,7 +188,13 @@
|
||||||
"_journal/2024-02/2024-02-20.md": "af2ef10727726200c4defe2eafc7d841",
|
"_journal/2024-02/2024-02-20.md": "af2ef10727726200c4defe2eafc7d841",
|
||||||
"algebra/radices.md": "0fcd901c798eaed8075ff1375e2429dd",
|
"algebra/radices.md": "0fcd901c798eaed8075ff1375e2429dd",
|
||||||
"_journal/2024-02-22.md": "e01f1d4bd2f7ac2a667cdfd500885a2a",
|
"_journal/2024-02-22.md": "e01f1d4bd2f7ac2a667cdfd500885a2a",
|
||||||
"_journal/2024-02/2024-02-21.md": "a627f267700f36abd5ceb9b4c294479e"
|
"_journal/2024-02/2024-02-21.md": "f423137ae550eb958378750d1f5e98c7",
|
||||||
|
"_journal/2024-02-23.md": "9750fc77ccd67fd29dc5af0cdc0d16b7",
|
||||||
|
"_journal/2024-02/2024-02-22.md": "312e55d57868026f6e80f7989a889c2b",
|
||||||
|
"c17/strings.md": "bbe8983602adbeb38eff214beddedd84",
|
||||||
|
"c17/index.md": "78576ee41d0185df82c59999142f4edb",
|
||||||
|
"c17/escape-sequences.md": "ebc63c6cdfbe60bbc2708c1b0c8da8bb",
|
||||||
|
"c17/declarations.md": "d8920390eae79da5d9be08d050ca1b51"
|
||||||
},
|
},
|
||||||
"fields_dict": {
|
"fields_dict": {
|
||||||
"Basic": [
|
"Basic": [
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
---
|
||||||
|
title: "2024-02-23"
|
||||||
|
---
|
||||||
|
|
||||||
|
- [x] Anki Flashcards
|
||||||
|
- [x] KoL
|
||||||
|
- [ ] Sheet Music (10 min.)
|
||||||
|
- [x] OGS (1 Life & Death Problem)
|
||||||
|
- [ ] Korean (Read 1 Story)
|
||||||
|
- [ ] Interview Prep (1 Practice Problem)
|
||||||
|
- [ ] Log Work Hours (Max 3 hours)
|
||||||
|
|
||||||
|
* 101weiqi (serial numbers)
|
||||||
|
* Q-28857
|
||||||
|
* Q-120650
|
||||||
|
* Q-123426
|
||||||
|
* Q-10929
|
||||||
|
* Q-10924
|
||||||
|
* Q-9107
|
|
@ -119,7 +119,7 @@ Basic
|
||||||
How does C evaluate `10 / 3`?
|
How does C evaluate `10 / 3`?
|
||||||
Back: `3`
|
Back: `3`
|
||||||
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
|
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
|
||||||
Tags: c
|
Tags: c17
|
||||||
<!--ID: 1708110779720-->
|
<!--ID: 1708110779720-->
|
||||||
END%%
|
END%%
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ Basic
|
||||||
How does C evaluate `floor(10.f / 3)`?
|
How does C evaluate `floor(10.f / 3)`?
|
||||||
Back: `3`
|
Back: `3`
|
||||||
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
|
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
|
||||||
Tags: c
|
Tags: c17
|
||||||
<!--ID: 1708110779725-->
|
<!--ID: 1708110779725-->
|
||||||
END%%
|
END%%
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ Basic
|
||||||
How does C evaluate `ceil(10.f / 3)`?
|
How does C evaluate `ceil(10.f / 3)`?
|
||||||
Back: `4`
|
Back: `4`
|
||||||
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
|
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
|
||||||
Tags: c
|
Tags: c17
|
||||||
<!--ID: 1708110779729-->
|
<!--ID: 1708110779729-->
|
||||||
END%%
|
END%%
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ Basic
|
||||||
How does C evaluate `-10 / 3`?
|
How does C evaluate `-10 / 3`?
|
||||||
Back: `-3`
|
Back: `-3`
|
||||||
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
|
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
|
||||||
Tags: c
|
Tags: c17
|
||||||
<!--ID: 1708110779734-->
|
<!--ID: 1708110779734-->
|
||||||
END%%
|
END%%
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ Basic
|
||||||
How does C evaluate `floor(-10.f / 3)`?
|
How does C evaluate `floor(-10.f / 3)`?
|
||||||
Back: `-4`
|
Back: `-4`
|
||||||
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
|
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
|
||||||
Tags: c
|
Tags: c17
|
||||||
<!--ID: 1708110779738-->
|
<!--ID: 1708110779738-->
|
||||||
END%%
|
END%%
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ Basic
|
||||||
How does C evaluate `ceil(-10.f / 3)`?
|
How does C evaluate `ceil(-10.f / 3)`?
|
||||||
Back: `-3`
|
Back: `-3`
|
||||||
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
|
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
|
||||||
Tags: c
|
Tags: c17
|
||||||
<!--ID: 1708110779742-->
|
<!--ID: 1708110779742-->
|
||||||
END%%
|
END%%
|
||||||
|
|
||||||
|
@ -195,7 +195,7 @@ END%%
|
||||||
%%ANKI
|
%%ANKI
|
||||||
Basic
|
Basic
|
||||||
If `A[p..q]` has odd size, what `r` most fairly allows partitions `A[p..r]` and `A[r+1..q]`?
|
If `A[p..q]` has odd size, what `r` most fairly allows partitions `A[p..r]` and `A[r+1..q]`?
|
||||||
Back: $r = \lfloor (p + q) / 2 \rfloor = \lceil (p + q) / 2 \rceil$
|
Back: $r = (p + q) / 2$
|
||||||
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
|
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
|
||||||
<!--ID: 1708114757958-->
|
<!--ID: 1708114757958-->
|
||||||
END%%
|
END%%
|
||||||
|
@ -203,7 +203,7 @@ END%%
|
||||||
%%ANKI
|
%%ANKI
|
||||||
Basic
|
Basic
|
||||||
If `A[p..q]` has odd size, what `r` most fairly allows partitions `A[p..r-1]` and `A[r..q]`?
|
If `A[p..q]` has odd size, what `r` most fairly allows partitions `A[p..r-1]` and `A[r..q]`?
|
||||||
Back: $r = \lfloor (p + q) / 2 \rfloor = \lceil (p + q) / 2 \rceil$
|
Back: $r = (p + q) / 2$
|
||||||
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
|
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
|
||||||
<!--ID: 1708114757961-->
|
<!--ID: 1708114757961-->
|
||||||
END%%
|
END%%
|
||||||
|
@ -211,7 +211,7 @@ END%%
|
||||||
%%ANKI
|
%%ANKI
|
||||||
Basic
|
Basic
|
||||||
If `A[p..q]` has odd size, what `r` ensures `A[p..r-1]` has same size as `A[r+1..q]`?
|
If `A[p..q]` has odd size, what `r` ensures `A[p..r-1]` has same size as `A[r+1..q]`?
|
||||||
Back: $r = \lfloor (p + q) / 2 \rfloor = \lceil (p + q) / 2 \rceil$
|
Back: $r = (p + q) / 2$
|
||||||
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
|
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
|
||||||
<!--ID: 1708114757964-->
|
<!--ID: 1708114757964-->
|
||||||
END%%
|
END%%
|
||||||
|
|
|
@ -57,7 +57,7 @@ for (int i = 0; i < n; ++i) { ... }
|
||||||
```
|
```
|
||||||
Back: After `int i = 0` but before `i < n`.
|
Back: After `int i = 0` but before `i < n`.
|
||||||
Reference: Thomas H. Cormen et al., *Introduction to Algorithms*, 3rd ed (Cambridge, Mass: MIT Press, 2009).
|
Reference: Thomas H. Cormen et al., *Introduction to Algorithms*, 3rd ed (Cambridge, Mass: MIT Press, 2009).
|
||||||
Tags: c
|
Tags: c17
|
||||||
<!--ID: 1707329732931-->
|
<!--ID: 1707329732931-->
|
||||||
END%%
|
END%%
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ Basic
|
||||||
How are bytes of `int32_t x = 0x01234567` written in big-endian?
|
How are bytes of `int32_t x = 0x01234567` written in big-endian?
|
||||||
Back: `0x01 0x23 0x45 0x67`
|
Back: `0x01 0x23 0x45 0x67`
|
||||||
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||||
Tags: c
|
Tags: c17
|
||||||
<!--ID: 1707661283779-->
|
<!--ID: 1707661283779-->
|
||||||
END%%
|
END%%
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ Basic
|
||||||
How are bytes of `int32_t x = 0x01234567` written in little-endian?
|
How are bytes of `int32_t x = 0x01234567` written in little-endian?
|
||||||
Back: `0x67 0x45 0x23 0x01`
|
Back: `0x67 0x45 0x23 0x01`
|
||||||
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||||
Tags: c
|
Tags: c17
|
||||||
<!--ID: 1707661283780-->
|
<!--ID: 1707661283780-->
|
||||||
END%%
|
END%%
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ Basic
|
||||||
How might you use C to find the weight of a bit string?
|
How might you use C to find the weight of a bit string?
|
||||||
Back: Repeatedly divide by `2`, counting all remainders of `1`.
|
Back: Repeatedly divide by `2`, counting all remainders of `1`.
|
||||||
Reference: Oscar Levin, *Discrete Mathematics: An Open Introduction*, 3rd ed., n.d., [https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf](https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf).
|
Reference: Oscar Levin, *Discrete Mathematics: An Open Introduction*, 3rd ed., n.d., [https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf](https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf).
|
||||||
Tags: c
|
Tags: c17
|
||||||
<!--ID: 1708366788648-->
|
<!--ID: 1708366788648-->
|
||||||
END%%
|
END%%
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ Basic
|
||||||
What is a C integral type?
|
What is a C integral type?
|
||||||
Back: A type representing finite ranges of integers.
|
Back: A type representing finite ranges of integers.
|
||||||
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||||
Tags: c
|
Tags: c17
|
||||||
<!--ID: 1708177246087-->
|
<!--ID: 1708177246087-->
|
||||||
END%%
|
END%%
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ Basic
|
||||||
In what two ways are C integral types encoded?
|
In what two ways are C integral types encoded?
|
||||||
Back: Unsigned encoding or two's-complement.
|
Back: Unsigned encoding or two's-complement.
|
||||||
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||||
Tags: c
|
Tags: c17
|
||||||
<!--ID: 1708177246093-->
|
<!--ID: 1708177246093-->
|
||||||
END%%
|
END%%
|
||||||
|
|
||||||
|
@ -548,7 +548,7 @@ END%%
|
||||||
|
|
||||||
## Casting
|
## Casting
|
||||||
|
|
||||||
Most implementations of C cast an object of one type to another by simply re-interpreting their binary representation. This casting may happen implicitly if comparing or operating on e.g. `signed` and `unsigned` objects in the same expression. $T2U$ and $U2T$ reflect this method of casting:
|
Most implementations of C cast an object of one type to another by simply re-interpreting the object's binary representation. This casting may happen implicitly if comparing or operating on e.g. `signed` and `unsigned` objects in the same expression. $T2U$ and $U2T$ reflect this method of casting:
|
||||||
|
|
||||||
$$T2U_w(x) = \begin{cases}
|
$$T2U_w(x) = \begin{cases}
|
||||||
x + 2^w & x < 0 \\
|
x + 2^w & x < 0 \\
|
||||||
|
@ -565,7 +565,7 @@ Basic
|
||||||
How do most implementations of C perform casting?
|
How do most implementations of C perform casting?
|
||||||
Back: As a reinterpretation of the same byte pattern of the object being casted.
|
Back: As a reinterpretation of the same byte pattern of the object being casted.
|
||||||
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||||
Tags: c
|
Tags: c17
|
||||||
<!--ID: 1708615249879-->
|
<!--ID: 1708615249879-->
|
||||||
END%%
|
END%%
|
||||||
|
|
||||||
|
@ -579,10 +579,10 @@ END%%
|
||||||
|
|
||||||
%%ANKI
|
%%ANKI
|
||||||
Basic
|
Basic
|
||||||
For what decimal values $x$ does $T2U_w$ and $U2T_w$ serve as the identity function?
|
For what values $x$ does $T2U_w(x) = U2T_w(x) = x$?
|
||||||
Back: $0 \leq x \leq TMax_w$
|
Back: $0 \leq x \leq TMax_w$
|
||||||
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||||
<!--ID: 1708615249887-->
|
<!--ID: 1708696117167-->
|
||||||
END%%
|
END%%
|
||||||
|
|
||||||
%%ANKI
|
%%ANKI
|
||||||
|
@ -590,7 +590,7 @@ Basic
|
||||||
What values $x$ are unaffected when casting from `signed` to `unsigned`?
|
What values $x$ are unaffected when casting from `signed` to `unsigned`?
|
||||||
Back: $0 \leq x \leq TMax_w$
|
Back: $0 \leq x \leq TMax_w$
|
||||||
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||||
Tags: c
|
Tags: c17
|
||||||
<!--ID: 1708615249891-->
|
<!--ID: 1708615249891-->
|
||||||
END%%
|
END%%
|
||||||
|
|
||||||
|
@ -599,7 +599,7 @@ Basic
|
||||||
What values $x$ are unaffected when casting from `unsigned` to `signed`?
|
What values $x$ are unaffected when casting from `unsigned` to `signed`?
|
||||||
Back: $0 \leq x \leq TMax_w$
|
Back: $0 \leq x \leq TMax_w$
|
||||||
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||||
Tags: c
|
Tags: c17
|
||||||
<!--ID: 1708615249897-->
|
<!--ID: 1708615249897-->
|
||||||
END%%
|
END%%
|
||||||
|
|
||||||
|
@ -608,7 +608,7 @@ Basic
|
||||||
How are casts implicitly performed in operations containing `signed` and `unsigned` objects?
|
How are casts implicitly performed in operations containing `signed` and `unsigned` objects?
|
||||||
Back: `signed` objects are cast to `unsigned` objects.
|
Back: `signed` objects are cast to `unsigned` objects.
|
||||||
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||||
Tags: c
|
Tags: c17
|
||||||
<!--ID: 1708615249903-->
|
<!--ID: 1708615249903-->
|
||||||
END%%
|
END%%
|
||||||
|
|
||||||
|
@ -664,6 +664,92 @@ Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Program
|
||||||
<!--ID: 1708615249939-->
|
<!--ID: 1708615249939-->
|
||||||
END%%
|
END%%
|
||||||
|
|
||||||
|
### Expansion
|
||||||
|
|
||||||
|
For unsigned encoding, use **zero extension** to convert numbers to larger types. For example, $1010_2$ can be expanded to 8-bit $00001010_2$.
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Cloze
|
||||||
|
Use {zero} extension to convert {unsigned} numbers to larger types.
|
||||||
|
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||||
|
<!--ID: 1708697867799-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
Zero extension is generally used for what type of integer encoding?
|
||||||
|
Back: Unsigned.
|
||||||
|
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||||
|
<!--ID: 1708697867807-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
*Why* does zero extension of unsigned numbers work?
|
||||||
|
Back: The weights of additional bits are zeroed out.
|
||||||
|
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||||
|
<!--ID: 1708697867810-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
*Why* does zero extension of two's-complement numbers generally not work?
|
||||||
|
Back: A negative value would have its new sign bit be positive.
|
||||||
|
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||||
|
<!--ID: 1708697867814-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
How is $\langle x_3, x_2, x_1, x_0 \rangle$ zero extended to 8 bits?
|
||||||
|
Back: As $\langle 0, 0, 0, 0, x_3, x_2, x_1, x_0 \rangle$
|
||||||
|
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||||
|
<!--ID: 1708697867818-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
For two's-complement, use **sign extension** to convert numbers to larger types. This means the additional leftmost bits are set to match the sign bit of the original number. For example, $1010_2$ can be expanded to 8-bit $11111010_2$.
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Cloze
|
||||||
|
Use {sign} extension to convert {two's-complement} numbers to larger types.
|
||||||
|
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||||
|
<!--ID: 1708697867821-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
Sign extension is generally used for what type of integer encoding?
|
||||||
|
Back: Two's-complement.
|
||||||
|
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||||
|
<!--ID: 1708697867825-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
*Why* does sign extension of two's-complement numbers work?
|
||||||
|
Back: The new sign bit weight is equal to the swing in the previous sign bit weight.
|
||||||
|
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||||
|
<!--ID: 1708697867829-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
*Why* does sign extension of unsigned numbers generally not work?
|
||||||
|
Back: It actually does, though we technically call it zero extension.
|
||||||
|
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||||
|
<!--ID: 1708697867833-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
How is $\langle x_3, x_2, x_1, x_0 \rangle$ sign extended to 8 bits?
|
||||||
|
Back: As $\langle x_3, x_3, x_3, x_3, x_3, x_2, x_1, x_0 \rangle$
|
||||||
|
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||||
|
<!--ID: 1708697867839-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
### Truncation
|
||||||
|
|
||||||
## References
|
## 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.
|
||||||
|
|
|
@ -79,7 +79,7 @@ Basic
|
||||||
What portability issue do shift operations introduce?
|
What portability issue do shift operations introduce?
|
||||||
Back: There is no standard on whether right shifts of signed numbers are logical or arithmetic.
|
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.
|
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||||
Tags: c
|
Tags: c17
|
||||||
<!--ID: 1707854589808-->
|
<!--ID: 1707854589808-->
|
||||||
END%%
|
END%%
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ END%%
|
||||||
Cloze
|
Cloze
|
||||||
{1:Arithmetic} right shifts are to {1:signed} numbers whereas {2:logical} right shifts are to {2:unsigned} numbers.
|
{1:Arithmetic} right shifts are to {1:signed} numbers whereas {2:logical} right shifts are to {2:unsigned} numbers.
|
||||||
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||||
Tags: c
|
Tags: c17
|
||||||
<!--ID: 1707854589813-->
|
<!--ID: 1707854589813-->
|
||||||
END%%
|
END%%
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ Basic
|
||||||
Ignoring UB, what *typically* happens when shifting an `int32_t` by `k ≥ 32` bits?
|
Ignoring UB, what *typically* happens when shifting an `int32_t` by `k ≥ 32` bits?
|
||||||
Back: The shift value is interpreted as `k mod 32`.
|
Back: The shift value is interpreted as `k mod 32`.
|
||||||
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||||
Tags: c
|
Tags: c17
|
||||||
<!--ID: 1707873410777-->
|
<!--ID: 1707873410777-->
|
||||||
END%%
|
END%%
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ Basic
|
||||||
How is $x \bmod 2^k$ equivalently written as a bit mask?
|
How is $x \bmod 2^k$ equivalently written as a bit mask?
|
||||||
Back: `x & ((1 << k) - 1)`
|
Back: `x & ((1 << k) - 1)`
|
||||||
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||||
Tags: c
|
Tags: c17
|
||||||
<!--ID: 1707873410780-->
|
<!--ID: 1707873410780-->
|
||||||
END%%
|
END%%
|
||||||
|
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
---
|
|
||||||
title: C
|
|
||||||
tags:
|
|
||||||
- c
|
|
||||||
---
|
|
|
@ -1,9 +1,9 @@
|
||||||
---
|
---
|
||||||
title: Declarations
|
title: Declarations
|
||||||
TARGET DECK: Obsidian::STEM
|
TARGET DECK: Obsidian::STEM
|
||||||
FILE TAGS: c
|
FILE TAGS: c17
|
||||||
tags:
|
tags:
|
||||||
- c
|
- c17
|
||||||
---
|
---
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
@ -207,14 +207,14 @@ END%%
|
||||||
|
|
||||||
Negative integer literals are typed in a counterintuitive way. When the compiler sees a number of form `-X`, the type of `X` is first determined *before* then being negated. Promotion rules are as follows:
|
Negative integer literals are typed in a counterintuitive way. When the compiler sees a number of form `-X`, the type of `X` is first determined *before* then being negated. Promotion rules are as follows:
|
||||||
|
|
||||||
C90 (Decimal) | C90 (Other) | C99 (Decimal) | C99 (Other)
|
Decimal | Other Bases
|
||||||
--------------- | --------------- | ------------- | ---------
|
----------- | --------------------
|
||||||
`int` | `int` | `int` | `int`
|
`int` | `int`
|
||||||
`long` | `unsigned` | `long` | `unsigned`
|
`long` | `unsigned`
|
||||||
`unsigned` | `long` | `long long` | `long`
|
`long long` | `long`
|
||||||
`unsigned long` | `unsigned long` | `-` | `unsigned long`
|
`-` | `unsigned long`
|
||||||
`-` | `-` | `-` | `long long`
|
`-` | `long long`
|
||||||
`-` | `-` | `-` | `unsigned long long`
|
`-` | `unsigned long long`
|
||||||
|
|
||||||
%%ANKI
|
%%ANKI
|
||||||
Basic
|
Basic
|
||||||
|
@ -226,31 +226,7 @@ END%%
|
||||||
|
|
||||||
%%ANKI
|
%%ANKI
|
||||||
Basic
|
Basic
|
||||||
What simplification did C99 introduce to decimal integer literals?
|
What integer literals are guaranteed `signed`?
|
||||||
Back: The integer constant is guaranteed a `signed` type.
|
|
||||||
Reference: Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
|
||||||
<!--ID: 1708631820816-->
|
|
||||||
END%%
|
|
||||||
|
|
||||||
%%ANKI
|
|
||||||
Basic
|
|
||||||
Since what standard was it guaranteed decimal integer literals were `signed`?
|
|
||||||
Back: C99
|
|
||||||
Reference: Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
|
||||||
<!--ID: 1708631820820-->
|
|
||||||
END%%
|
|
||||||
|
|
||||||
%%ANKI
|
|
||||||
Basic
|
|
||||||
In ISO C90, what integer literals are guaranteed `signed`?
|
|
||||||
Back: None.
|
|
||||||
Reference: Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
|
||||||
<!--ID: 1708631820823-->
|
|
||||||
END%%
|
|
||||||
|
|
||||||
%%ANKI
|
|
||||||
Basic
|
|
||||||
In ISO C99, what integer literals are guaranteed `signed`?
|
|
||||||
Back: Decimal integer constants.
|
Back: Decimal integer constants.
|
||||||
Reference: Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
Reference: Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||||
<!--ID: 1708631820826-->
|
<!--ID: 1708631820826-->
|
|
@ -1,9 +1,9 @@
|
||||||
---
|
---
|
||||||
title: Escape Sequences
|
title: Escape Sequences
|
||||||
TARGET DECK: Obsidian::STEM
|
TARGET DECK: Obsidian::STEM
|
||||||
FILE TAGS: c
|
FILE TAGS: c17
|
||||||
tags:
|
tags:
|
||||||
- c
|
- c17
|
||||||
---
|
---
|
||||||
|
|
||||||
## Overview
|
## Overview
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
title: C17
|
||||||
|
tags:
|
||||||
|
- c17
|
||||||
|
---
|
|
@ -1,9 +1,9 @@
|
||||||
---
|
---
|
||||||
title: Strings
|
title: Strings
|
||||||
TARGET DECK: Obsidian::STEM
|
TARGET DECK: Obsidian::STEM
|
||||||
FILE TAGS: c
|
FILE TAGS: c17
|
||||||
tags:
|
tags:
|
||||||
- c
|
- c17
|
||||||
---
|
---
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
@ -164,7 +164,7 @@ END%%
|
||||||
|
|
||||||
%%ANKI
|
%%ANKI
|
||||||
Basic
|
Basic
|
||||||
The `-` flag overrides what default behavior?
|
The `-` `printf` flag overrides what default behavior?
|
||||||
Back: Output is right-aligned by default.
|
Back: Output is right-aligned by default.
|
||||||
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).
|
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).
|
||||||
<!--ID: 1707918756840-->
|
<!--ID: 1707918756840-->
|
||||||
|
@ -172,14 +172,14 @@ END%%
|
||||||
|
|
||||||
%%ANKI
|
%%ANKI
|
||||||
Cloze
|
Cloze
|
||||||
The {`+`} flag {prepends a plus for positive signed-numeric types}.
|
The {`+`} `printf` flag {prepends a plus for positive signed-numeric types}.
|
||||||
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).
|
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).
|
||||||
<!--ID: 1707918756846-->
|
<!--ID: 1707918756846-->
|
||||||
END%%
|
END%%
|
||||||
|
|
||||||
%%ANKI
|
%%ANKI
|
||||||
Basic
|
Basic
|
||||||
The `+` flag overrides what default behavior?
|
The `+` `printf` flag overrides what default behavior?
|
||||||
Back: Nothing is prepended to positive signed-numeric types by default.
|
Back: Nothing is prepended to positive signed-numeric types by default.
|
||||||
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).
|
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).
|
||||||
<!--ID: 1707918756852-->
|
<!--ID: 1707918756852-->
|
||||||
|
@ -187,14 +187,14 @@ END%%
|
||||||
|
|
||||||
%%ANKI
|
%%ANKI
|
||||||
Cloze
|
Cloze
|
||||||
The {`␣`} flag {prepends a space for positive signed-numeric types}.
|
The {`␣`} `printf` flag {prepends a space for positive signed-numeric types}.
|
||||||
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).
|
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).
|
||||||
<!--ID: 1707918756856-->
|
<!--ID: 1707918756856-->
|
||||||
END%%
|
END%%
|
||||||
|
|
||||||
%%ANKI
|
%%ANKI
|
||||||
Basic
|
Basic
|
||||||
The `␣` flag overrides what default behavior?
|
The `␣` `printf` flag overrides what default behavior?
|
||||||
Back: Nothing is prepended to positive signed-numeric types by default.
|
Back: Nothing is prepended to positive signed-numeric types by default.
|
||||||
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).
|
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).
|
||||||
<!--ID: 1707918756861-->
|
<!--ID: 1707918756861-->
|
||||||
|
@ -202,7 +202,7 @@ END%%
|
||||||
|
|
||||||
%%ANKI
|
%%ANKI
|
||||||
Basic
|
Basic
|
||||||
How do the `+` and `␣` flags relate to one another?
|
How do the `+` and `␣` `printf` flags relate to one another?
|
||||||
Back: Both prepend a character to positive signed-numeric types.
|
Back: Both prepend a character to positive signed-numeric types.
|
||||||
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).
|
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).
|
||||||
<!--ID: 1707918756865-->
|
<!--ID: 1707918756865-->
|
||||||
|
@ -210,7 +210,7 @@ END%%
|
||||||
|
|
||||||
%%ANKI
|
%%ANKI
|
||||||
Basic
|
Basic
|
||||||
What happens if both the `+` and `␣` flags are specified?
|
What happens if both the `+` and `␣` `printf` flags are specified?
|
||||||
Back: The `+` flag takes precedence.
|
Back: The `+` flag takes precedence.
|
||||||
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).
|
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).
|
||||||
<!--ID: 1707918756870-->
|
<!--ID: 1707918756870-->
|
||||||
|
@ -218,14 +218,14 @@ END%%
|
||||||
|
|
||||||
%%ANKI
|
%%ANKI
|
||||||
Cloze
|
Cloze
|
||||||
The {`0`} flag {prepends zeros for numeric types}.
|
The {`0`} `printf` flag {prepends zeros for numeric types}.
|
||||||
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).
|
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).
|
||||||
<!--ID: 1707918756875-->
|
<!--ID: 1707918756875-->
|
||||||
END%%
|
END%%
|
||||||
|
|
||||||
%%ANKI
|
%%ANKI
|
||||||
Basic
|
Basic
|
||||||
What option must be specified for the `0` flag to take effect?
|
What option must be specified for the `0` `printf` flag to take effect?
|
||||||
Back: The "width" option.
|
Back: The "width" option.
|
||||||
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).
|
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).
|
||||||
<!--ID: 1707918756881-->
|
<!--ID: 1707918756881-->
|
||||||
|
@ -233,7 +233,7 @@ END%%
|
||||||
|
|
||||||
%%ANKI
|
%%ANKI
|
||||||
Basic
|
Basic
|
||||||
The `0` flag overrides what default behavior?
|
The `0` `printf` flag overrides what default behavior?
|
||||||
Back: Spaces are used to match the "width" option by default.
|
Back: Spaces are used to match the "width" option by default.
|
||||||
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).
|
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).
|
||||||
<!--ID: 1707918756888-->
|
<!--ID: 1707918756888-->
|
|
@ -42,7 +42,7 @@ Basic
|
||||||
Which C construct corresponds to the additive property?
|
Which C construct corresponds to the additive property?
|
||||||
Back: `union`
|
Back: `union`
|
||||||
Reference: Oscar Levin, *Discrete Mathematics: An Open Introduction*, 3rd ed., n.d., [https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf](https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf).
|
Reference: Oscar Levin, *Discrete Mathematics: An Open Introduction*, 3rd ed., n.d., [https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf](https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf).
|
||||||
Tags: c
|
Tags: c17
|
||||||
<!--ID: 1708221293486-->
|
<!--ID: 1708221293486-->
|
||||||
END%%
|
END%%
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ END%%
|
||||||
Cloze
|
Cloze
|
||||||
{`union`} is to the additive property whereas {`struct`} is to the multiplicative property.
|
{`union`} is to the additive property whereas {`struct`} is to the multiplicative property.
|
||||||
Reference: Oscar Levin, *Discrete Mathematics: An Open Introduction*, 3rd ed., n.d., [https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf](https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf).
|
Reference: Oscar Levin, *Discrete Mathematics: An Open Introduction*, 3rd ed., n.d., [https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf](https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf).
|
||||||
Tags: c
|
Tags: c17
|
||||||
<!--ID: 1708221293483-->
|
<!--ID: 1708221293483-->
|
||||||
END%%
|
END%%
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ Basic
|
||||||
Which C construct corresponds to the multiplicative property?
|
Which C construct corresponds to the multiplicative property?
|
||||||
Back: `struct`
|
Back: `struct`
|
||||||
Reference: Oscar Levin, *Discrete Mathematics: An Open Introduction*, 3rd ed., n.d., [https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf](https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf).
|
Reference: Oscar Levin, *Discrete Mathematics: An Open Introduction*, 3rd ed., n.d., [https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf](https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf).
|
||||||
Tags: c
|
Tags: c17
|
||||||
<!--ID: 1708221293489-->
|
<!--ID: 1708221293489-->
|
||||||
END%%
|
END%%
|
||||||
|
|
||||||
|
|
|
@ -310,7 +310,7 @@ END%%
|
||||||
|
|
||||||
## Exit Status
|
## Exit Status
|
||||||
|
|
||||||
On success, `gawk` exits with status code `EXIT_SUCCESS`. On failure, with status code `EXIT_FAILURE`. On fatal error, `gawk` exists with status code `2`. #c
|
On success, `gawk` exits with status code `EXIT_SUCCESS`. On failure, with status code `EXIT_FAILURE`. On fatal error, `gawk` exists with status code `2`. #c17
|
||||||
|
|
||||||
You can specify a custom exit status by using the `exit` statement from within the `awk` program.
|
You can specify a custom exit status by using the `exit` statement from within the `awk` program.
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ Basic
|
||||||
What C logical operator corresponds to $\neg$?
|
What C logical operator corresponds to $\neg$?
|
||||||
Back: `!`
|
Back: `!`
|
||||||
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
|
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
|
||||||
Tags: c
|
Tags: c17
|
||||||
<!--ID: 1706994861325-->
|
<!--ID: 1706994861325-->
|
||||||
END%%
|
END%%
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ Basic
|
||||||
What C logical operator corresponds to $\land$?
|
What C logical operator corresponds to $\land$?
|
||||||
Back: There isn't one.
|
Back: There isn't one.
|
||||||
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
|
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
|
||||||
Tags: c
|
Tags: c17
|
||||||
<!--ID: 1706994861327-->
|
<!--ID: 1706994861327-->
|
||||||
END%%
|
END%%
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ Basic
|
||||||
What C logical operator corresponds to $\lor$?
|
What C logical operator corresponds to $\lor$?
|
||||||
Back: There isn't one.
|
Back: There isn't one.
|
||||||
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
|
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
|
||||||
Tags: c
|
Tags: c17
|
||||||
<!--ID: 1706994861329-->
|
<!--ID: 1706994861329-->
|
||||||
END%%
|
END%%
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ Basic
|
||||||
What C logical operator corresponds to $\Rightarrow$?
|
What C logical operator corresponds to $\Rightarrow$?
|
||||||
Back: There isn't one.
|
Back: There isn't one.
|
||||||
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
|
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
|
||||||
Tags: c
|
Tags: c17
|
||||||
<!--ID: 1706994861331-->
|
<!--ID: 1706994861331-->
|
||||||
END%%
|
END%%
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ Basic
|
||||||
What C logical operator corresponds to $\Leftrightarrow$?
|
What C logical operator corresponds to $\Leftrightarrow$?
|
||||||
Back: `==`
|
Back: `==`
|
||||||
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
|
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
|
||||||
Tags: c
|
Tags: c17
|
||||||
<!--ID: 1706994861333-->
|
<!--ID: 1706994861333-->
|
||||||
END%%
|
END%%
|
||||||
|
|
||||||
|
|
|
@ -855,8 +855,16 @@ END%%
|
||||||
|
|
||||||
%%ANKI
|
%%ANKI
|
||||||
Basic
|
Basic
|
||||||
How can we write an expression equivalent to $s(E_e^x)$ that doesn't use textual substitution?
|
If $s' = (s; x{:}s(e))$, then $s'(E) = s(E_e^x)$. Why do we not say $s' = (s; x{:}e)$ instead?
|
||||||
Back: Write $s'(E)$ where $s' = (s; x{:}e)$.
|
Back: The value of a state's identifier must always be a constant proposition.
|
||||||
|
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
|
||||||
|
<!--ID: 1708693353856-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
How do define $s'$ such that $s(E_e^x) = s'(E)$?
|
||||||
|
Back: $s' = (s; x{:}s(e))$.
|
||||||
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
|
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
|
||||||
<!--ID: 1707939006292-->
|
<!--ID: 1707939006292-->
|
||||||
END%%
|
END%%
|
||||||
|
|
|
@ -172,7 +172,7 @@ END%%
|
||||||
|
|
||||||
%%ANKI
|
%%ANKI
|
||||||
Basic
|
Basic
|
||||||
Which of *if*/*only if* map to *necessary*?
|
Which of *if* or *only if* map to *necessary*?
|
||||||
Back: *if*
|
Back: *if*
|
||||||
Reference: Oscar Levin, *Discrete Mathematics: An Open Introduction*, 3rd ed., n.d., [https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf](https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf).
|
Reference: Oscar Levin, *Discrete Mathematics: An Open Introduction*, 3rd ed., n.d., [https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf](https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf).
|
||||||
<!--ID: 1708199272151-->
|
<!--ID: 1708199272151-->
|
||||||
|
@ -180,7 +180,7 @@ END%%
|
||||||
|
|
||||||
%%ANKI
|
%%ANKI
|
||||||
Basic
|
Basic
|
||||||
Which of *if*/*only if* map to *sufficient*?
|
Which of *if* or *only if* map to *sufficient*?
|
||||||
Back: *only if*
|
Back: *only if*
|
||||||
Reference: Oscar Levin, *Discrete Mathematics: An Open Introduction*, 3rd ed., n.d., [https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf](https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf).
|
Reference: Oscar Levin, *Discrete Mathematics: An Open Introduction*, 3rd ed., n.d., [https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf](https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf).
|
||||||
<!--ID: 1708199272157-->
|
<!--ID: 1708199272157-->
|
||||||
|
|
|
@ -23,7 +23,7 @@ Basic
|
||||||
What C operator corresponds to $\textbf{cand}$?
|
What C operator corresponds to $\textbf{cand}$?
|
||||||
Back: `&&`
|
Back: `&&`
|
||||||
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
|
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
|
||||||
Tags: c
|
Tags: c17
|
||||||
<!--ID: 1707316606004-->
|
<!--ID: 1707316606004-->
|
||||||
END%%
|
END%%
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ Basic
|
||||||
What C operator corresponds to $\textbf{cor}$?
|
What C operator corresponds to $\textbf{cor}$?
|
||||||
Back: `||`
|
Back: `||`
|
||||||
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
|
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
|
||||||
Tags: c
|
Tags: c17
|
||||||
<!--ID: 1707316606007-->
|
<!--ID: 1707316606007-->
|
||||||
END%%
|
END%%
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue