Skip to content

Commit

Permalink
Better variable names.
Browse files Browse the repository at this point in the history
  • Loading branch information
janpgit committed Mar 17, 2024
1 parent f5185da commit 65e4ce2
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions modules/arithmetic-promotion-and-conversions.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ example:

```C
int i;
unsigned long long ll;
unsigned long long ull;

i + ll; // type of the result is unsigned long long and 'i'
i + ull; // type of the result is unsigned long long and 'i'
// is converted to unsigned long long BEFORE '+' is
// applied. See below what happens if 'i' contains a
// negative number.
Expand Down Expand Up @@ -61,7 +61,7 @@ sizeof (c + 1) // is 4
```

Note that we already know that `c` is **never** modified as the expression in
`sizeof` is never evaluated. See the
`sizeof` is never evaluated. See the
#module sizeof.md sizeof module
for to review the knowledge.

Expand Down Expand Up @@ -407,18 +407,18 @@ variables:
* incorporate into the C code, compile, and verify you got it right.
*/

unsigned long long ll = -13; // Use %llu in printf() to verify.
signed char c = 999; // %d
short int si = -1; // %hd
unsigned int = -1; // %u
unsigned short int usi = 999999; // %hu
signed char c = 0 ? -10 : 0U; // %d
signed char c = -1 ? -10 : 0U; // %d
long long ll = 1U + -10; // %lld
unsigned long long ull = 1U + -10; // %llu
unsigned short int si = INT_MIN + 13LU; // %hu
unsigned short int si = -INT_MAX + 13U; // %hu
signed char c = 129; // %d
unsigned long long ull = -13; // Use %llu in printf() to verify.
signed char sc = 999; // %d
short int si = -1; // %hd
unsigned int ui = -1; // %u
unsigned short int usi = 999999; // %hu
signed char sc = 0 ? -10 : 0U; // %d
signed char sc = -1 ? -10 : 0U; // %d
long long ll = 1U + -10; // %lld
unsigned long long ull = 1U + -10; // %llu
unsigned short int usi = INT_MIN + 13LU; // %hu
unsigned short int usi = -INT_MAX + 13U; // %hu
signed char sc = 129; // %d

/* What is printed? */
printf("%hhu\n", -3);
Expand Down

0 comments on commit 65e4ce2

Please sign in to comment.