Reorganizing C declarations file.
parent
2c099dff15
commit
618e016c1a
|
@ -254,7 +254,7 @@
|
|||
"combinatorics/additive-principle.md": "d036ac511e382d5c1caca437341a5915",
|
||||
"_journal/2024-02-19.md": "30d16c5373deb9cb128d2e7934ae256a",
|
||||
"_journal/2024-02/2024-02-18.md": "67e36dbbb2cac699d4533b5a2eaeb629",
|
||||
"combinatorics/permutations.md": "efd0820ab3cc7faa5b2df3fe40105110",
|
||||
"combinatorics/permutations.md": "f2f3188f4e1142ec39de1e44ac5a1f0a",
|
||||
"combinatorics/combinations.md": "396fc32255710eaf33213efaafdc43d4",
|
||||
"_journal/2024-02-20.md": "b85ba0eeeb16e30a602ccefabcc9763e",
|
||||
"_journal/2024-02/2024-02-19.md": "df1a9ab7ab89244021b3003c84640c78",
|
||||
|
@ -269,7 +269,7 @@
|
|||
"c17/strings.md": "2da50edd26eae35c81f70e65bbd12d49",
|
||||
"c17/index.md": "78576ee41d0185df82c59999142f4edb",
|
||||
"c17/escape-sequences.md": "a8b99070336878b4e8c11e9e4525a500",
|
||||
"c17/declarations.md": "ab6d44e48b0c1c8d98cd409721cc2c53",
|
||||
"c17/declarations.md": "eb289ab10ccb8b1a7981ceedbbdda2ad",
|
||||
"algorithms/sorting/merge-sort.md": "6506483f7df6507cee0407bd205dbedd",
|
||||
"_journal/2024-02-24.md": "9bb319d5014caf962a9ce3141076cff4",
|
||||
"_journal/2024-02/2024-02-23.md": "0aad297148e8cc4058b48b7e45787ca7",
|
||||
|
@ -495,7 +495,7 @@
|
|||
"_journal/2024-05/2024-05-25.md": "3e8a0061fa58a6e5c48d12800d1ab869",
|
||||
"_journal/2024-05-27.md": "b36636d10eab34380f17f288868df3ae",
|
||||
"_journal/2024-05/2024-05-26.md": "abe84b5beae74baa25501c818e64fc95",
|
||||
"algebra/set.md": "b4d5ce4b914abe5063bf6043cf7a0aee",
|
||||
"algebra/set.md": "30a13f1db3c53dbff179eca2873d7732",
|
||||
"algebra/boolean.md": "fc47edb7d0080b73ce1ce0d3e0e16d7d",
|
||||
"git/merge-conflicts.md": "761ad6137ec51d3877f7d5b3615ca5cb",
|
||||
"_journal/2024-05-28.md": "0f6aeb5ec126560acdc2d8c5c6570337",
|
||||
|
@ -520,7 +520,7 @@
|
|||
"_journal/2024-06/2024-06-04.md": "52b28035b9c91c9b14cef1154c1a0fa1",
|
||||
"_journal/2024-06-06.md": "3f9109925dea304e7172df39922cc95a",
|
||||
"_journal/2024-06/2024-06-05.md": "b06a0fa567bd81e3b593f7e1838f9de1",
|
||||
"set/relations.md": "84a66a74805014d3b88ea5e8a3e763bc",
|
||||
"set/relations.md": "9f59faf0f21dfe49ad89ac6e8115d269",
|
||||
"_journal/2024-06-07.md": "795be41cc3c9c0f27361696d237604a2",
|
||||
"_journal/2024-06/2024-06-06.md": "db3407dcc86fa759b061246ec9fbd381",
|
||||
"_journal/2024-06-08.md": "b20d39dab30b4e12559a831ab8d2f9b8",
|
||||
|
@ -659,7 +659,7 @@
|
|||
"_journal/2024-07/2024-07-26.md": "c167f734a5037e1a5537b1e95ca6790f",
|
||||
"_journal/2024-07-28.md": "8a2393673132ac57a86b3b528bfc4a16",
|
||||
"_journal/2024-07/2024-07-27.md": "7c48690746d8320494e29e92390eb6ee",
|
||||
"ontology/rdf/uri.md": "07999207f65ffb35f55af42c9922e7c5",
|
||||
"ontology/rdf/uri.md": "7dde3e92eee17ea85e75df3fdc5f8d51",
|
||||
"ontology/rdf/index.md": "36424c9bad6088cdee67f74e3b8a019f",
|
||||
"ontology/philosophy/permissivism.md": "643e815a79bc5c050cde9f996aa44ef5",
|
||||
"ontology/philosophy/nominalism.md": "46245c644238157e15c7cb6def27d90a",
|
||||
|
@ -674,9 +674,12 @@
|
|||
"_journal/2024-07/2024-07-31.md": "d397c5a4d42660eeaa290aa8316d55c1",
|
||||
"_journal/2024-07/2024-07-30.md": "025194b9b770b56a81b5a52d96a305f2",
|
||||
"_journal/2024-08-02.md": "24648f61c675c1c52e4cb19cbac6f0dc",
|
||||
"_journal/2024-08-03.md": "27f1316f792f7673cd7ea1b1e44444be",
|
||||
"_journal/2024-08-03.md": "1afbd61dac3039aa3637a9c472813d67",
|
||||
"_journal/2024-08/2024-08-02.md": "076c35545f292eddd3c7253a41fbd40c",
|
||||
"_journal/2024-08/2024-08-01.md": "2e3da352cfbaf29b6b49e3c3a4f090df"
|
||||
"_journal/2024-08/2024-08-01.md": "2e3da352cfbaf29b6b49e3c3a4f090df",
|
||||
"_journal/2024-08-04.md": "f3675ba4cd33f16a5695732bbe10473e",
|
||||
"_journal/2024-08/2024-08-03.md": "7c1d3dbaf47d1120bb879110e827d1b3",
|
||||
"c17/pointers.md": "c80957f5cab7403b85bcabcc9ce983ef"
|
||||
},
|
||||
"fields_dict": {
|
||||
"Basic": [
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
---
|
||||
title: "2024-08-04"
|
||||
---
|
||||
|
||||
- [x] Anki Flashcards
|
||||
- [x] KoL
|
||||
- [x] OGS
|
||||
- [ ] Sheet Music (10 min.)
|
||||
- [ ] Korean (Read 1 Story)
|
|
@ -9,3 +9,4 @@ title: "2024-08-03"
|
|||
- [ ] Korean (Read 1 Story)
|
||||
|
||||
* Additional notes on binary search trees.
|
||||
* Notes on (strong) [[relations#Connected|connectivity]] of relations.
|
|
@ -207,7 +207,7 @@ END%%
|
|||
%%ANKI
|
||||
Basic
|
||||
Assume AoC and $H(j) \neq \varnothing$ for all $j \in I$. What does $\bigtimes_{i \in I} H(i)$ evaluate to?
|
||||
Back: A non-empty set.
|
||||
Back: $\{f \mid f \text{ is a function with domain } I \text{ and } \forall i \in I, f(i) \in H(i)\}$
|
||||
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||
<!--ID: 1720964209709-->
|
||||
END%%
|
||||
|
|
|
@ -8,6 +8,323 @@ tags:
|
|||
|
||||
## Overview
|
||||
|
||||
C declarations were designed so that the declaration of an object looks like the use of the object. This isn't quite true - keywords like `volatile` and `const` only exist in declarations - but for the most part, this philosophy can be leveraged to read C declarations.
|
||||
|
||||
## Declarators
|
||||
|
||||
A **declarator** in C is roughly an identifier along with pointers, function brackets, or array indications. Pointers will look like one of:
|
||||
|
||||
* `*`
|
||||
* `* const`
|
||||
* `* volatile`
|
||||
* `* const volatile`
|
||||
* `* volatile const`
|
||||
|
||||
whereas **direct declarators** will look like one of:
|
||||
|
||||
* `identifier`
|
||||
* `identifier[size]`
|
||||
* `identifier(args)`
|
||||
* `(declarator)`
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What two qualifiers can be found on a pointer?
|
||||
Back: `const` and `volatile`.
|
||||
Reference: Van der Linden, Peter. _Expert C Programming: Deep C Secrets_. Programming Languages / C. Mountain View, Cal.: SunSoft Pr, 1994.
|
||||
<!--ID: 1722786892098-->
|
||||
END%%
|
||||
|
||||
## Declarations
|
||||
|
||||
A **declaration** consists of at least one type-specifier (e.g. `signed short`), storage class (e.g. `static`), and/or type qualifier (e.g. `const`) as well as one or more declarators.
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
How many declarators does a declaration have?
|
||||
Back: At least one.
|
||||
Reference: Van der Linden, Peter. _Expert C Programming: Deep C Secrets_. Programming Languages / C. Mountain View, Cal.: SunSoft Pr, 1994.
|
||||
<!--ID: 1722786892100-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
How many declarations does a declarator have?
|
||||
Back: N/A.
|
||||
Reference: Van der Linden, Peter. _Expert C Programming: Deep C Secrets_. Programming Languages / C. Mountain View, Cal.: SunSoft Pr, 1994.
|
||||
<!--ID: 1722786892101-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
Which part of the following are declarators?
|
||||
```c
|
||||
int* a, b;
|
||||
```
|
||||
Back: `* a` and `b`.
|
||||
Reference: Van der Linden, Peter. _Expert C Programming: Deep C Secrets_. Programming Languages / C. Mountain View, Cal.: SunSoft Pr, 1994.
|
||||
<!--ID: 1722786892102-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
Which part of the following are declarations?
|
||||
```c
|
||||
int* a, b;
|
||||
```
|
||||
Back: The entire line is a single declaration.
|
||||
Reference: Van der Linden, Peter. _Expert C Programming: Deep C Secrets_. Programming Languages / C. Mountain View, Cal.: SunSoft Pr, 1994.
|
||||
<!--ID: 1722786892103-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
Which part of the following declaration is the declarator?
|
||||
```c
|
||||
const int *const x;
|
||||
```
|
||||
Back: `*const x`
|
||||
Reference: Van der Linden, Peter. _Expert C Programming: Deep C Secrets_. Programming Languages / C. Mountain View, Cal.: SunSoft Pr, 1994.
|
||||
<!--ID: 1722786892104-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
Which part of the following declaration is the type specifier?
|
||||
```c
|
||||
const int *const x;
|
||||
```
|
||||
Back: `int`
|
||||
Reference: Van der Linden, Peter. _Expert C Programming: Deep C Secrets_. Programming Languages / C. Mountain View, Cal.: SunSoft Pr, 1994.
|
||||
<!--ID: 1722786892105-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
Which part of the following declaration is the type qualifier?
|
||||
```c
|
||||
const int *const x;
|
||||
```
|
||||
Back: The first `const`.
|
||||
Reference: Van der Linden, Peter. _Expert C Programming: Deep C Secrets_. Programming Languages / C. Mountain View, Cal.: SunSoft Pr, 1994.
|
||||
<!--ID: 1722786892106-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What is the type of `x` in the following?
|
||||
```c
|
||||
const int *const x, y;
|
||||
```
|
||||
Back: `const int* const`
|
||||
Reference: Van der Linden, Peter. _Expert C Programming: Deep C Secrets_. Programming Languages / C. Mountain View, Cal.: SunSoft Pr, 1994.
|
||||
<!--ID: 1722786892107-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What is the type of `y` in the following?
|
||||
```c
|
||||
const int *const x, y;
|
||||
```
|
||||
Back: `const int`
|
||||
Reference: Van der Linden, Peter. _Expert C Programming: Deep C Secrets_. Programming Languages / C. Mountain View, Cal.: SunSoft Pr, 1994.
|
||||
<!--ID: 1722786892108-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What is the type of `x` in the following?
|
||||
```c
|
||||
#define int_ptr int *
|
||||
int_ptr x, y;
|
||||
```
|
||||
Back: `int *`
|
||||
Reference: Van der Linden, Peter. _Expert C Programming: Deep C Secrets_. Programming Languages / C. Mountain View, Cal.: SunSoft Pr, 1994.
|
||||
<!--ID: 1722786892109-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What is the type of `y` in the following?
|
||||
```c
|
||||
#define int_ptr int *
|
||||
int_ptr x, y;
|
||||
```
|
||||
Back: `int`
|
||||
Reference: Van der Linden, Peter. _Expert C Programming: Deep C Secrets_. Programming Languages / C. Mountain View, Cal.: SunSoft Pr, 1994.
|
||||
<!--ID: 1722786892110-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What is the type of `x` in the following?
|
||||
```c
|
||||
typedef int_ptr int *
|
||||
int_ptr x, y;
|
||||
```
|
||||
Back: `int *`
|
||||
Reference: Van der Linden, Peter. _Expert C Programming: Deep C Secrets_. Programming Languages / C. Mountain View, Cal.: SunSoft Pr, 1994.
|
||||
<!--ID: 1722786892111-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What is the type of `y` in the following?
|
||||
```c
|
||||
typedef int_ptr int *
|
||||
int_ptr x, y;
|
||||
```
|
||||
Back: `int *`
|
||||
Reference: Van der Linden, Peter. _Expert C Programming: Deep C Secrets_. Programming Languages / C. Mountain View, Cal.: SunSoft Pr, 1994.
|
||||
<!--ID: 1722786892112-->
|
||||
END%%
|
||||
|
||||
Declarations can be read by complying with the precedence rules outlined below:
|
||||
|
||||
1. Find the name of the declaration.
|
||||
2. Obey the following precedence rules:
|
||||
1. Parentheses grouping together parts of a declaration
|
||||
2. Postfix operators `()` and `[]`
|
||||
3. Prefix operator: the asterisk `*` denoting "pointer to"
|
||||
3. If `const` and/or `volatile` keyword is next to a type specifier, it applies to the type specifier. Otherwise it applies to the pointer asterisk on its immediate left.
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
In the precedence rules for C declarations, what available postfix operators are there?
|
||||
Back: `()` and `[]`.
|
||||
Reference: Van der Linden, Peter. _Expert C Programming: Deep C Secrets_. Programming Languages / C. Mountain View, Cal.: SunSoft Pr, 1994.
|
||||
<!--ID: 1722786892113-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
In the precedence rules for C declarations, what available prefix operators are there?
|
||||
Back: Just `*`.
|
||||
Reference: Van der Linden, Peter. _Expert C Programming: Deep C Secrets_. Programming Languages / C. Mountain View, Cal.: SunSoft Pr, 1994.
|
||||
<!--ID: 1722786892114-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
In the precedence rules for C declarations, what available type qualifiers are there?
|
||||
Back: `const` and `volatile`.
|
||||
Reference: Van der Linden, Peter. _Expert C Programming: Deep C Secrets_. Programming Languages / C. Mountain View, Cal.: SunSoft Pr, 1994.
|
||||
<!--ID: 1722786892115-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What is the type of `foo` in the the following declaration?
|
||||
```c
|
||||
char *const *(*foo)();
|
||||
```
|
||||
Back: A pointer to a function returning a pointer to a `const` pointer-to-char.
|
||||
Reference: Van der Linden, Peter. _Expert C Programming: Deep C Secrets_. Programming Languages / C. Mountain View, Cal.: SunSoft Pr, 1994.
|
||||
<!--ID: 1722786892116-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What is the type of `foo` in the the following declaration?
|
||||
```c
|
||||
char *const *foo();
|
||||
```
|
||||
Back: A function returning a pointer to a `const` pointer-to-char.
|
||||
Reference: Van der Linden, Peter. _Expert C Programming: Deep C Secrets_. Programming Languages / C. Mountain View, Cal.: SunSoft Pr, 1994.
|
||||
<!--ID: 1722786892117-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What is the type of `foo` in the the following declaration?
|
||||
```c
|
||||
int (*(*foo)(void))[3]
|
||||
```
|
||||
Back: A pointer to a function (accepting `void`) returning a pointer to an array of `int`s.
|
||||
Reference: Van der Linden, Peter. _Expert C Programming: Deep C Secrets_. Programming Languages / C. Mountain View, Cal.: SunSoft Pr, 1994.
|
||||
<!--ID: 1722786892118-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What is the type of `foo` in the the following declaration?
|
||||
```c
|
||||
const int (* volatile foo)[64]
|
||||
```
|
||||
Back: A `volatile` pointer to an array of `const int`s.
|
||||
Reference: Van der Linden, Peter. _Expert C Programming: Deep C Secrets_. Programming Languages / C. Mountain View, Cal.: SunSoft Pr, 1994.
|
||||
<!--ID: 1722786892119-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What is the type of `foo` in the the following declaration?
|
||||
```c
|
||||
const int * const foo;
|
||||
```
|
||||
Back: A `const` pointer to a `const int`.
|
||||
Reference: Van der Linden, Peter. _Expert C Programming: Deep C Secrets_. Programming Languages / C. Mountain View, Cal.: SunSoft Pr, 1994.
|
||||
<!--ID: 1722786892120-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What is the type of `foo` in the the following declaration?
|
||||
```c
|
||||
const int * foo;
|
||||
```
|
||||
Back: A pointer to a `const int`.
|
||||
Reference: Van der Linden, Peter. _Expert C Programming: Deep C Secrets_. Programming Languages / C. Mountain View, Cal.: SunSoft Pr, 1994.
|
||||
<!--ID: 1722786892121-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What is the type of `foo` in the the following declaration?
|
||||
```c
|
||||
int const * foo;
|
||||
```
|
||||
Back: A pointer to a `const int`.
|
||||
Reference: Van der Linden, Peter. _Expert C Programming: Deep C Secrets_. Programming Languages / C. Mountain View, Cal.: SunSoft Pr, 1994.
|
||||
<!--ID: 1722786892122-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What is the type of `foo` in the the following declaration?
|
||||
```c
|
||||
int * const foo;
|
||||
```
|
||||
Back: A `const` pointer-to-int.
|
||||
Reference: Van der Linden, Peter. _Expert C Programming: Deep C Secrets_. Programming Languages / C. Mountain View, Cal.: SunSoft Pr, 1994.
|
||||
<!--ID: 1722786892123-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What is the type of `foo` in the the following declaration?
|
||||
```c
|
||||
char *(*foo[10])(int **);
|
||||
```
|
||||
Back: An array of pointers to functions (accepting `int **`) returning pointer-to-char.
|
||||
Reference: Van der Linden, Peter. _Expert C Programming: Deep C Secrets_. Programming Languages / C. Mountain View, Cal.: SunSoft Pr, 1994.
|
||||
<!--ID: 1722786892124-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What is the type of `signal` in the the following declaration?
|
||||
```c
|
||||
void (*signal(int sig, void (*func)(int)))(int);
|
||||
```
|
||||
Back: A function (accepting an `int` and `void (*)(int)`) returning a pointer to a function (accepting an `int`) returning `void`.
|
||||
Reference: Van der Linden, Peter. _Expert C Programming: Deep C Secrets_. Programming Languages / C. Mountain View, Cal.: SunSoft Pr, 1994.
|
||||
<!--ID: 1722786892125-->
|
||||
END%%
|
||||
|
||||
### Type Specifiers
|
||||
|
||||
Signed | Unsigned | 32-bit | 64-bit
|
||||
----------- | ------------------- | ------ | ------
|
||||
signed char | unsigned char | 1 | 1
|
||||
|
@ -210,6 +527,182 @@ Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Program
|
|||
<!--ID: 1718281813458-->
|
||||
END%%
|
||||
|
||||
### Structs
|
||||
|
||||
A `struct` is a grouping of data together. It has the following general form:
|
||||
|
||||
```c
|
||||
struct optional_tag {
|
||||
type_1 ident1;
|
||||
...
|
||||
type_N identN;
|
||||
} optional_var1 ... optional_varM;
|
||||
```
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What is the underlined portion of the following declaration called?
|
||||
```c
|
||||
struct ___ { ... };
|
||||
```
|
||||
Back: The tag.
|
||||
Reference: Van der Linden, Peter. _Expert C Programming: Deep C Secrets_. Programming Languages / C. Mountain View, Cal.: SunSoft Pr, 1994.
|
||||
<!--ID: 1722786892126-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What distinguishes the `X`'s from one another in the following?
|
||||
```c
|
||||
struct X { ... } X;
|
||||
```
|
||||
Back: The first `X` is a tag whereas the second is a variable with type `struct X`.
|
||||
Reference: Van der Linden, Peter. _Expert C Programming: Deep C Secrets_. Programming Languages / C. Mountain View, Cal.: SunSoft Pr, 1994.
|
||||
<!--ID: 1722786892127-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What distinguishes the `X`'s from one another in the following?
|
||||
```c
|
||||
typedef struct X { ... } X;
|
||||
```
|
||||
Back: The first `X` is a tag whereas the second is an alias for type `struct X`.
|
||||
Reference: Van der Linden, Peter. _Expert C Programming: Deep C Secrets_. Programming Languages / C. Mountain View, Cal.: SunSoft Pr, 1994.
|
||||
<!--ID: 1722786892128-->
|
||||
END%%
|
||||
|
||||
### Unions
|
||||
|
||||
A `union` is a grouping of data together but with overlaid storage. It has the following general form:
|
||||
|
||||
```c
|
||||
union optional_tag {
|
||||
type1 ident1;
|
||||
...
|
||||
typeN identN;
|
||||
} optional_var1 ... optional_varN;
|
||||
```
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What is the underlined portion of the following declaration called?
|
||||
```c
|
||||
union ___ { ... };
|
||||
```
|
||||
Back: The tag.
|
||||
Reference: Van der Linden, Peter. _Expert C Programming: Deep C Secrets_. Programming Languages / C. Mountain View, Cal.: SunSoft Pr, 1994.
|
||||
<!--ID: 1722786892129-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What distinguishes the `X`'s from one another in the following?
|
||||
```c
|
||||
union X { ... } X;
|
||||
```
|
||||
Back: The first `X` is a tag whereas the second is a variable with type `union X`.
|
||||
Reference: Van der Linden, Peter. _Expert C Programming: Deep C Secrets_. Programming Languages / C. Mountain View, Cal.: SunSoft Pr, 1994.
|
||||
<!--ID: 1722786892130-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What distinguishes the `X`'s from one another in the following?
|
||||
```c
|
||||
typedef union X { ... } X;
|
||||
```
|
||||
Back: The first `X` is a tag whereas the second is an alias for type `union X`.
|
||||
Reference: Van der Linden, Peter. _Expert C Programming: Deep C Secrets_. Programming Languages / C. Mountain View, Cal.: SunSoft Pr, 1994.
|
||||
<!--ID: 1722786892131-->
|
||||
END%%
|
||||
|
||||
### Enums
|
||||
|
||||
An `enum` is a mapping of identifiers with integer values. They have general form:
|
||||
|
||||
```c
|
||||
enum optional_tag {
|
||||
type1 ident1;
|
||||
...
|
||||
typeN identN;
|
||||
} optional_var1 ... optional_varN;
|
||||
```
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What is the underlined portion of the following declaration called?
|
||||
```c
|
||||
enum ___ { ... };
|
||||
```
|
||||
Back: The tag.
|
||||
Reference: Van der Linden, Peter. _Expert C Programming: Deep C Secrets_. Programming Languages / C. Mountain View, Cal.: SunSoft Pr, 1994.
|
||||
<!--ID: 1722786892132-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What distinguishes the `X`'s from one another in the following?
|
||||
```c
|
||||
enum X { ... } X;
|
||||
```
|
||||
Back: The first `X` is a tag whereas the second is a variable with type `enum X`.
|
||||
Reference: Van der Linden, Peter. _Expert C Programming: Deep C Secrets_. Programming Languages / C. Mountain View, Cal.: SunSoft Pr, 1994.
|
||||
<!--ID: 1722786892133-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What distinguishes the `X`'s from one another in the following?
|
||||
```c
|
||||
typedef enum X { ... } X;
|
||||
```
|
||||
Back: The first `X` is a tag whereas the second is an alias for type `enum X`.
|
||||
Reference: Van der Linden, Peter. _Expert C Programming: Deep C Secrets_. Programming Languages / C. Mountain View, Cal.: SunSoft Pr, 1994.
|
||||
<!--ID: 1722786892134-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What is the value of `A` in the following?
|
||||
```c
|
||||
enum X { A, B, C };
|
||||
```
|
||||
Back: `0`
|
||||
Reference: Van der Linden, Peter. _Expert C Programming: Deep C Secrets_. Programming Languages / C. Mountain View, Cal.: SunSoft Pr, 1994.
|
||||
<!--ID: 1722786892135-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What is the value of `B` in the following?
|
||||
```c
|
||||
enum X { A, B, C };
|
||||
```
|
||||
Back: `1`
|
||||
Reference: Van der Linden, Peter. _Expert C Programming: Deep C Secrets_. Programming Languages / C. Mountain View, Cal.: SunSoft Pr, 1994.
|
||||
<!--ID: 1722786892136-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What is the value of `B` in the following?
|
||||
```c
|
||||
enum X { A=2, B, C };
|
||||
```
|
||||
Back: `3`
|
||||
Reference: Van der Linden, Peter. _Expert C Programming: Deep C Secrets_. Programming Languages / C. Mountain View, Cal.: SunSoft Pr, 1994.
|
||||
<!--ID: 1722786892137-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What is the "only advantage" of `enum`s over `#define` according to Linden?
|
||||
Back: `enum`s can usually be traced in a debugger.
|
||||
Reference: Van der Linden, Peter. _Expert C Programming: Deep C Secrets_. Programming Languages / C. Mountain View, Cal.: SunSoft Pr, 1994.
|
||||
<!--ID: 1722786892138-->
|
||||
END%%
|
||||
|
||||
## Integer Literals
|
||||
|
||||
Negative integer literals are typed in a counterintuitive way. When the compiler sees a number of form `-X`, the type of `X` is determined *before* being negated. Promotion rules are as follows:
|
||||
|
@ -415,18 +908,7 @@ Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Program
|
|||
<!--ID: 1714677608769-->
|
||||
END%%
|
||||
|
||||
## Pointers
|
||||
|
||||
Pointers have the same size as the machine's word size since it should be able to refer to any virtual address.
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
*Why* does a pointer's size match the machine's word size?
|
||||
Back: Because it should be able to refer to any virtual address.
|
||||
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||
<!--ID: 1707493017246-->
|
||||
END%%
|
||||
|
||||
## Bibliography
|
||||
|
||||
* Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||
* Van der Linden, Peter. _Expert C Programming: Deep C Secrets_. Programming Languages / C. Mountain View, Cal.: SunSoft Pr, 1994.
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
---
|
||||
title: Pointers
|
||||
TARGET DECK: Obsidian::STEM
|
||||
FILE TAGS: c17
|
||||
tags:
|
||||
- c17
|
||||
---
|
||||
|
||||
## Overview
|
||||
|
||||
Pointers have the same size as the machine's word size since it should be able to refer to any virtual address.
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
*Why* does a pointer's size match the machine's word size?
|
||||
Back: Because it should be able to refer to any virtual address.
|
||||
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||
<!--ID: 1707493017246-->
|
||||
END%%
|
||||
|
||||
## Bibliography
|
||||
|
||||
* Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
|
@ -128,12 +128,20 @@ END%%
|
|||
|
||||
%%ANKI
|
||||
Basic
|
||||
*Why* might $0! = 1$ (barring convention)?
|
||||
Back: Because the empty product is $1$, the multiplication identity.
|
||||
How is the multiplication identity used to justify equality $0! = 1$?
|
||||
Back: The empty product is $1$, i.e. the multiplication identity.
|
||||
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: 1708366788603-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What combinatorial explanation justifies equality $0! = 1$?
|
||||
Back: There is only $1$ way to order $0$ objects.
|
||||
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: 1722775277862-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What combinatorial concept explains the number of bijective functions between two finite sets?
|
||||
|
|
|
@ -162,7 +162,7 @@ END%%
|
|||
|
||||
%%ANKI
|
||||
Basic
|
||||
The following URI has what scheme? $$\text{http://www.example.com/questions/3456/my-document}$$
|
||||
The following URI specifies what scheme? $$\text{http://www.example.com/questions/3456/my-document}$$
|
||||
Back: `http`
|
||||
Reference: “Uniform Resource Identifier.” In _Wikipedia_, July 22, 2024. [https://en.wikipedia.org/w/index.php?title=Uniform_Resource_Identifier](https://en.wikipedia.org/w/index.php?title=Uniform_Resource_Identifier&oldid=1235957234).
|
||||
<!--ID: 1722212201466-->
|
||||
|
@ -170,7 +170,7 @@ END%%
|
|||
|
||||
%%ANKI
|
||||
Basic
|
||||
The following URI has what authority? $$\text{http://www.example.com/questions/3456/my-document}$$
|
||||
The following URI specifies what authority? $$\text{http://www.example.com/questions/3456/my-document}$$
|
||||
Back: `//www.example.com`
|
||||
Reference: “Uniform Resource Identifier.” In _Wikipedia_, July 22, 2024. [https://en.wikipedia.org/w/index.php?title=Uniform_Resource_Identifier](https://en.wikipedia.org/w/index.php?title=Uniform_Resource_Identifier&oldid=1235957234).
|
||||
<!--ID: 1722212201450-->
|
||||
|
@ -178,23 +178,23 @@ END%%
|
|||
|
||||
%%ANKI
|
||||
Basic
|
||||
The following URI has what userinfo? $$\text{http://www.example.com/questions/3456/my-document}$$
|
||||
Back: N/A. It is undefined
|
||||
The following URI specifies what userinfo? $$\text{http://www.example.com/questions/3456/my-document}$$
|
||||
Back: N/A. It is undefined.
|
||||
Reference: “Uniform Resource Identifier.” In _Wikipedia_, July 22, 2024. [https://en.wikipedia.org/w/index.php?title=Uniform_Resource_Identifier](https://en.wikipedia.org/w/index.php?title=Uniform_Resource_Identifier&oldid=1235957234).
|
||||
<!--ID: 1722212472982-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
The following URI has what port? $$\text{http://www.example.com/questions/3456/my-document}$$
|
||||
Back: N/A. It is undefined
|
||||
The following URI specifies what port? $$\text{http://www.example.com/questions/3456/my-document}$$
|
||||
Back: N/A. It is undefined.
|
||||
Reference: “Uniform Resource Identifier.” In _Wikipedia_, July 22, 2024. [https://en.wikipedia.org/w/index.php?title=Uniform_Resource_Identifier](https://en.wikipedia.org/w/index.php?title=Uniform_Resource_Identifier&oldid=1235957234).
|
||||
<!--ID: 1722212472988-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
The following URI has what host? $$\text{http://www.example.com/questions/3456/my-document}$$
|
||||
The following URI specifies what host? $$\text{http://www.example.com/questions/3456/my-document}$$
|
||||
Back: `www.example.com`
|
||||
Reference: “Uniform Resource Identifier.” In _Wikipedia_, July 22, 2024. [https://en.wikipedia.org/w/index.php?title=Uniform_Resource_Identifier](https://en.wikipedia.org/w/index.php?title=Uniform_Resource_Identifier&oldid=1235957234).
|
||||
<!--ID: 1722212472995-->
|
||||
|
@ -202,7 +202,7 @@ END%%
|
|||
|
||||
%%ANKI
|
||||
Basic
|
||||
The following URI has what path? $$\text{http://www.example.com/questions/3456/my-document}$$
|
||||
The following URI specifies what path? $$\text{http://www.example.com/questions/3456/my-document}$$
|
||||
Back: `/questions/3456/my-document`
|
||||
Reference: “Uniform Resource Identifier.” In _Wikipedia_, July 22, 2024. [https://en.wikipedia.org/w/index.php?title=Uniform_Resource_Identifier](https://en.wikipedia.org/w/index.php?title=Uniform_Resource_Identifier&oldid=1235957234).
|
||||
<!--ID: 1722212201416-->
|
||||
|
@ -210,7 +210,7 @@ END%%
|
|||
|
||||
%%ANKI
|
||||
Basic
|
||||
The following URI has what query? $$\text{http://www.example.com/questions/3456/my-document}$$
|
||||
The following URI specifies what query? $$\text{http://www.example.com/questions/3456/my-document}$$
|
||||
Back: N/A. It is undefined.
|
||||
Reference: “Uniform Resource Identifier.” In _Wikipedia_, July 22, 2024. [https://en.wikipedia.org/w/index.php?title=Uniform_Resource_Identifier](https://en.wikipedia.org/w/index.php?title=Uniform_Resource_Identifier&oldid=1235957234).
|
||||
<!--ID: 1722212201460-->
|
||||
|
@ -218,7 +218,7 @@ END%%
|
|||
|
||||
%%ANKI
|
||||
Basic
|
||||
The following URI has what fragment? $$\text{http://www.example.com/questions/3456/my-document}$$
|
||||
The following URI specifies what fragment? $$\text{http://www.example.com/questions/3456/my-document}$$
|
||||
Back: N/A. It is undefined.
|
||||
Reference: “Uniform Resource Identifier.” In _Wikipedia_, July 22, 2024. [https://en.wikipedia.org/w/index.php?title=Uniform_Resource_Identifier](https://en.wikipedia.org/w/index.php?title=Uniform_Resource_Identifier&oldid=1235957234).
|
||||
<!--ID: 1722212201472-->
|
||||
|
@ -228,7 +228,7 @@ END%%
|
|||
Cloze
|
||||
The authority of a URI has the following generic syntax:
|
||||
|
||||
{`[<userinfo>@]`}{`<host>`}{`[:<port>]}
|
||||
{`[<userinfo>@]`}{`<host>`}{`[:<port>]`}
|
||||
Reference: “Uniform Resource Identifier.” In _Wikipedia_, July 22, 2024. [https://en.wikipedia.org/w/index.php?title=Uniform_Resource_Identifier](https://en.wikipedia.org/w/index.php?title=Uniform_Resource_Identifier&oldid=1235957234).
|
||||
<!--ID: 1722211744669-->
|
||||
END%%
|
||||
|
@ -251,7 +251,7 @@ END%%
|
|||
|
||||
%%ANKI
|
||||
Basic
|
||||
The following URI has what fragment? $$\text{ldap://[2001:db8::7]/c=GB?objectClass?one}$$
|
||||
The following URI specifies what scheme? $$\text{ldap://[2001:db8::7]/c=GB?objectClass?one}$$
|
||||
Back: `ldap`
|
||||
Reference: “Uniform Resource Identifier.” In _Wikipedia_, July 22, 2024. [https://en.wikipedia.org/w/index.php?title=Uniform_Resource_Identifier](https://en.wikipedia.org/w/index.php?title=Uniform_Resource_Identifier&oldid=1235957234).
|
||||
<!--ID: 1722212473001-->
|
||||
|
@ -259,7 +259,7 @@ END%%
|
|||
|
||||
%%ANKI
|
||||
Basic
|
||||
The following URI has what fragment? $$\text{ldap://[2001:db8::7]/c=GB?objectClass?one}$$
|
||||
The following URI specifies what fragment? $$\text{ldap://[2001:db8::7]/c=GB?objectClass?one}$$
|
||||
Back: N/A. It is undefined.
|
||||
Reference: “Uniform Resource Identifier.” In _Wikipedia_, July 22, 2024. [https://en.wikipedia.org/w/index.php?title=Uniform_Resource_Identifier](https://en.wikipedia.org/w/index.php?title=Uniform_Resource_Identifier&oldid=1235957234).
|
||||
<!--ID: 1722212790216-->
|
||||
|
@ -267,7 +267,7 @@ END%%
|
|||
|
||||
%%ANKI
|
||||
Basic
|
||||
The following URI has what authority? $$\text{ldap://[2001:db8::7]/c=GB?objectClass?one}$$
|
||||
The following URI specifies what authority? $$\text{ldap://[2001:db8::7]/c=GB?objectClass?one}$$
|
||||
Back: `[2001:db8::7]`
|
||||
Reference: “Uniform Resource Identifier.” In _Wikipedia_, July 22, 2024. [https://en.wikipedia.org/w/index.php?title=Uniform_Resource_Identifier](https://en.wikipedia.org/w/index.php?title=Uniform_Resource_Identifier&oldid=1235957234).
|
||||
<!--ID: 1722212790223-->
|
||||
|
@ -275,7 +275,7 @@ END%%
|
|||
|
||||
%%ANKI
|
||||
Basic
|
||||
The following URI has what query? $$\text{ldap://[2001:db8::7]/c=GB?objectClass?one}$$
|
||||
The following URI specifies what query? $$\text{ldap://[2001:db8::7]/c=GB?objectClass?one}$$
|
||||
Back: `objectClass?one`
|
||||
Reference: “Uniform Resource Identifier.” In _Wikipedia_, July 22, 2024. [https://en.wikipedia.org/w/index.php?title=Uniform_Resource_Identifier](https://en.wikipedia.org/w/index.php?title=Uniform_Resource_Identifier&oldid=1235957234).
|
||||
<!--ID: 1722212790228-->
|
||||
|
@ -283,7 +283,7 @@ END%%
|
|||
|
||||
%%ANKI
|
||||
Basic
|
||||
The following URI has what path? $$\text{ldap://[2001:db8::7]/c=GB?objectClass?one}$$
|
||||
The following URI specifies what path? $$\text{ldap://[2001:db8::7]/c=GB?objectClass?one}$$
|
||||
Back: `/c=GB`
|
||||
Reference: “Uniform Resource Identifier.” In _Wikipedia_, July 22, 2024. [https://en.wikipedia.org/w/index.php?title=Uniform_Resource_Identifier](https://en.wikipedia.org/w/index.php?title=Uniform_Resource_Identifier&oldid=1235957234).
|
||||
<!--ID: 1722212790232-->
|
||||
|
@ -291,7 +291,7 @@ END%%
|
|||
|
||||
%%ANKI
|
||||
Basic
|
||||
The following URI has what scheme? $$\text{tel:+1-816-555-1212}$$
|
||||
The following URI specifies what scheme? $$\text{tel:+1-816-555-1212}$$
|
||||
Back: `tel`
|
||||
Reference: “Uniform Resource Identifier.” In _Wikipedia_, July 22, 2024. [https://en.wikipedia.org/w/index.php?title=Uniform_Resource_Identifier](https://en.wikipedia.org/w/index.php?title=Uniform_Resource_Identifier&oldid=1235957234).
|
||||
<!--ID: 1722212790236-->
|
||||
|
@ -299,7 +299,7 @@ END%%
|
|||
|
||||
%%ANKI
|
||||
Basic
|
||||
The following URI has what authority? $$\text{tel:+1-816-555-1212}$$
|
||||
The following URI specifies what authority? $$\text{tel:+1-816-555-1212}$$
|
||||
Back: N/A. It is undefined.
|
||||
Reference: “Uniform Resource Identifier.” In _Wikipedia_, July 22, 2024. [https://en.wikipedia.org/w/index.php?title=Uniform_Resource_Identifier](https://en.wikipedia.org/w/index.php?title=Uniform_Resource_Identifier&oldid=1235957234).
|
||||
<!--ID: 1722212790241-->
|
||||
|
@ -307,7 +307,7 @@ END%%
|
|||
|
||||
%%ANKI
|
||||
Basic
|
||||
The following URI has what path? $$\text{tel:+1-816-555-1212}$$
|
||||
The following URI specifies what path? $$\text{tel:+1-816-555-1212}$$
|
||||
Back: `+1-816-555-1212`
|
||||
Reference: “Uniform Resource Identifier.” In _Wikipedia_, July 22, 2024. [https://en.wikipedia.org/w/index.php?title=Uniform_Resource_Identifier](https://en.wikipedia.org/w/index.php?title=Uniform_Resource_Identifier&oldid=1235957234).
|
||||
<!--ID: 1722212790247-->
|
||||
|
@ -315,7 +315,7 @@ END%%
|
|||
|
||||
%%ANKI
|
||||
Basic
|
||||
The following URI has what query? $$\text{tel:+1-816-555-1212}$$
|
||||
The following URI specifies what query? $$\text{tel:+1-816-555-1212}$$
|
||||
Back: N/A. It is undefined.
|
||||
Reference: “Uniform Resource Identifier.” In _Wikipedia_, July 22, 2024. [https://en.wikipedia.org/w/index.php?title=Uniform_Resource_Identifier](https://en.wikipedia.org/w/index.php?title=Uniform_Resource_Identifier&oldid=1235957234).
|
||||
<!--ID: 1722212790252-->
|
||||
|
@ -323,7 +323,7 @@ END%%
|
|||
|
||||
%%ANKI
|
||||
Basic
|
||||
The following URI has what fragment? $$\text{tel:+1-816-555-1212}$$
|
||||
The following URI specifies what fragment? $$\text{tel:+1-816-555-1212}$$
|
||||
Back: N/A. It is undefined.
|
||||
Reference: “Uniform Resource Identifier.” In _Wikipedia_, July 22, 2024. [https://en.wikipedia.org/w/index.php?title=Uniform_Resource_Identifier](https://en.wikipedia.org/w/index.php?title=Uniform_Resource_Identifier&oldid=1235957234).
|
||||
<!--ID: 1722212790258-->
|
||||
|
@ -331,7 +331,7 @@ END%%
|
|||
|
||||
%%ANKI
|
||||
Basic
|
||||
The following URI has what scheme? $$\text{telnet://192.0.2.16:80/}$$
|
||||
The following URI specifies what scheme? $$\text{telnet://192.0.2.16:80/}$$
|
||||
Back: `telnet`
|
||||
Reference: “Uniform Resource Identifier.” In _Wikipedia_, July 22, 2024. [https://en.wikipedia.org/w/index.php?title=Uniform_Resource_Identifier](https://en.wikipedia.org/w/index.php?title=Uniform_Resource_Identifier&oldid=1235957234).
|
||||
<!--ID: 1722212790265-->
|
||||
|
@ -339,7 +339,7 @@ END%%
|
|||
|
||||
%%ANKI
|
||||
Basic
|
||||
The following URI has what authority? $$\text{telnet://192.0.2.16:80/}$$
|
||||
The following URI specifies what authority? $$\text{telnet://192.0.2.16:80/}$$
|
||||
Back: `192.0.2.16:80`
|
||||
Reference: “Uniform Resource Identifier.” In _Wikipedia_, July 22, 2024. [https://en.wikipedia.org/w/index.php?title=Uniform_Resource_Identifier](https://en.wikipedia.org/w/index.php?title=Uniform_Resource_Identifier&oldid=1235957234).
|
||||
<!--ID: 1722212790272-->
|
||||
|
@ -347,7 +347,7 @@ END%%
|
|||
|
||||
%%ANKI
|
||||
Basic
|
||||
The following URI has what path? $$\text{telnet://192.0.2.16:80/}$$
|
||||
The following URI specifies what path? $$\text{telnet://192.0.2.16:80/}$$
|
||||
Back: `/`
|
||||
Reference: “Uniform Resource Identifier.” In _Wikipedia_, July 22, 2024. [https://en.wikipedia.org/w/index.php?title=Uniform_Resource_Identifier](https://en.wikipedia.org/w/index.php?title=Uniform_Resource_Identifier&oldid=1235957234).
|
||||
<!--ID: 1722212790279-->
|
||||
|
|
|
@ -1091,6 +1091,13 @@ Reference: “Antisymmetric Relation,” in _Wikipedia_, January 24, 2024, [http
|
|||
<!--ID: 1721912048142-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Cloze
|
||||
{1:Distinct} elements is to {2:antisymmetry} whereas {2:any} elements is to {1:asymmetry}.
|
||||
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||
<!--ID: 1722735199608-->
|
||||
END%%
|
||||
|
||||
## Transitivity
|
||||
|
||||
A relation $R$ is **transitive** iff whenever $xRy$ and $yRz$, then $xRz$. In relational algebra, we define $R$ to be transitive iff $R \circ R \subseteq R$.
|
||||
|
@ -1143,6 +1150,128 @@ Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Pre
|
|||
<!--ID: 1721694448736-->
|
||||
END%%
|
||||
|
||||
## Connected
|
||||
|
||||
A binary relation $R$ on set $A$ is said to be **connected** if for any *distinct* $x, y \in A$, either $xRy$ or $yRx$. The relation is **strongly connected** if for *all* $x, y \in A$, either $xRy$ or $yRx$.
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
How is connectivity of relation $R$ on set $A$ defined in FOL?
|
||||
Back: $\forall x, y \in A, x \neq y \Rightarrow xRy \lor yRx$
|
||||
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||
<!--ID: 1722735199628-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
Is $R = \{\langle a, b \rangle\}$ connected on set $\{a, b\}$?
|
||||
Back: Yes.
|
||||
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||
<!--ID: 1722735199637-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
Is $R = \{\langle a, a \rangle\}$ connected on set $\{a, b\}$?
|
||||
Back: No.
|
||||
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||
<!--ID: 1722735199645-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
*Why* isn't $R = \{\langle a, a \rangle, \langle b, b \rangle\}$ connected on set $\{a, b\}$?
|
||||
Back: Because neither $aRb$ nor $bRa$.
|
||||
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||
<!--ID: 1722735199650-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
Which of reflexivity or connectivity is the more general concept?
|
||||
Back: N/A.
|
||||
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||
<!--ID: 1722735199658-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What members must be added to make $R = \{\langle a, b \rangle, \langle b, c \rangle, \langle c, a \rangle\}$ connected on $\{a, b, c\}$?
|
||||
Back: N/A.
|
||||
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||
<!--ID: 1722735199662-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
How is strong connectivity of relation $R$ on set $A$ defined in FOL?
|
||||
Back: $\forall x, y \in A, xRy \lor yRx$
|
||||
Reference: “Connected Relation,” in _Wikipedia_, July 14, 2024, [https://en.wikipedia.org/w/index.php?title=Connected_relation](https://en.wikipedia.org/w/index.php?title=Connected_relation&oldid=1234415201).
|
||||
<!--ID: 1722735199672-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
Is $R = \{\langle a, b \rangle\}$ strongly connected on set $\{a, b\}$?
|
||||
Back: No.
|
||||
Reference: “Connected Relation,” in _Wikipedia_, July 14, 2024, [https://en.wikipedia.org/w/index.php?title=Connected_relation](https://en.wikipedia.org/w/index.php?title=Connected_relation&oldid=1234415201).
|
||||
<!--ID: 1722735199678-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
*Why* isn't $R = \{\langle a, b \rangle\}$ strongly connected on set $\{a, b\}$?
|
||||
Back: Because $\neg aRa$ and $\neg bRb$.
|
||||
Reference: “Connected Relation,” in _Wikipedia_, July 14, 2024, [https://en.wikipedia.org/w/index.php?title=Connected_relation](https://en.wikipedia.org/w/index.php?title=Connected_relation&oldid=1234415201).
|
||||
<!--ID: 1722735199683-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What members must be added to make $R = \{\langle a, b \rangle, \langle b, c \rangle, \langle c, a \rangle\}$ strongly connected on $\{a, b, c\}$?
|
||||
Back: $\langle a, a \rangle$, $\langle b, b \rangle$, $\langle c, c \rangle$
|
||||
Reference: “Connected Relation,” in _Wikipedia_, July 14, 2024, [https://en.wikipedia.org/w/index.php?title=Connected_relation](https://en.wikipedia.org/w/index.php?title=Connected_relation&oldid=1234415201).
|
||||
<!--ID: 1722735199688-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
Which of strong connectivity or reflexivity is the more general concept?
|
||||
Back: Reflexivity.
|
||||
Reference: “Connected Relation,” in _Wikipedia_, July 14, 2024, [https://en.wikipedia.org/w/index.php?title=Connected_relation](https://en.wikipedia.org/w/index.php?title=Connected_relation&oldid=1234415201).
|
||||
<!--ID: 1722735199695-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Cloze
|
||||
{1:Antisymmetry} is to {2:asymmetry} as {2:connectivity} is to {1:strong connectivity}.
|
||||
Reference: “Connected Relation,” in _Wikipedia_, July 14, 2024, [https://en.wikipedia.org/w/index.php?title=Connected_relation](https://en.wikipedia.org/w/index.php?title=Connected_relation&oldid=1234415201).
|
||||
<!--ID: 1722735199702-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
Why might we say asymmetry is "strong antisymmetry"?
|
||||
Back: The former implies the latter.
|
||||
Reference: “Connected Relation,” in _Wikipedia_, July 14, 2024, [https://en.wikipedia.org/w/index.php?title=Connected_relation](https://en.wikipedia.org/w/index.php?title=Connected_relation&oldid=1234415201).
|
||||
<!--ID: 1722735199707-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Cloze
|
||||
{1:Distinct} elements is to {2:connected} whereas {2:any} elements is to {1:strongly connected}.
|
||||
Reference: “Connected Relation,” in _Wikipedia_, July 14, 2024, [https://en.wikipedia.org/w/index.php?title=Connected_relation](https://en.wikipedia.org/w/index.php?title=Connected_relation&oldid=1234415201).
|
||||
<!--ID: 1722735199711-->
|
||||
END%%
|
||||
|
||||
%%ANKI
|
||||
Basic
|
||||
What makes "strong connectedness" stronger than "connectedness"?
|
||||
Back: The former implies the latter.
|
||||
Reference: “Connected Relation,” in _Wikipedia_, July 14, 2024, [https://en.wikipedia.org/w/index.php?title=Connected_relation](https://en.wikipedia.org/w/index.php?title=Connected_relation&oldid=1234415201).
|
||||
<!--ID: 1722735199715-->
|
||||
END%%
|
||||
|
||||
## Equivalence Relations
|
||||
|
||||
Given relation $R$ and set $A$, $R$ is an **equivalence relation on $A$** iff $R$ is a binary relation on $A$ that is reflexive on $A$, symmetric, and transitive.
|
||||
|
@ -1615,7 +1744,8 @@ END%%
|
|||
|
||||
* “Antisymmetric Relation,” in _Wikipedia_, January 24, 2024, [https://en.wikipedia.org/w/index.php?title=Antisymmetric_relation](https://en.wikipedia.org/w/index.php?title=Antisymmetric_relation&oldid=1198625107).
|
||||
* “Asymmetric Relation,” in _Wikipedia_, February 21, 2024, [https://en.wikipedia.org/w/index.php?title=Asymmetric_relation](https://en.wikipedia.org/w/index.php?title=Asymmetric_relation&oldid=1209290822).
|
||||
* “Cartesian Product,” in _Wikipedia_, April 17, 2024, [https://en.wikipedia.org/w/index.php?title=Cartesian_product&oldid=1219343305](https://en.wikipedia.org/w/index.php?title=Cartesian_product&oldid=1219343305).
|
||||
* Reference: “Equivalence Relation,” in _Wikipedia_, July 21, 2024, [https://en.wikipedia.org/w/index.php?title=Equivalence_relation](https://en.wikipedia.org/w/index.php?title=Equivalence_relation&oldid=1235801091).
|
||||
* “Cartesian Product,” in _Wikipedia_, April 17, 2024, [https://en.wikipedia.org/w/index.php?title=Cartesian_product](https://en.wikipedia.org/w/index.php?title=Cartesian_product&oldid=1219343305).
|
||||
* “Connected Relation,” in _Wikipedia_, July 14, 2024, [https://en.wikipedia.org/w/index.php?title=Connected_relation](https://en.wikipedia.org/w/index.php?title=Connected_relation&oldid=1234415201).
|
||||
* “Equivalence Relation,” in _Wikipedia_, July 21, 2024, [https://en.wikipedia.org/w/index.php?title=Equivalence_relation](https://en.wikipedia.org/w/index.php?title=Equivalence_relation&oldid=1235801091).
|
||||
* Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||
* “Partition of a Set,” in _Wikipedia_, June 18, 2024, [https://en.wikipedia.org/w/index.php?title=Partition_of_a_set](https://en.wikipedia.org/w/index.php?title=Partition_of_a_set&oldid=1229656401).
|
Loading…
Reference in New Issue