1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <assert.h>

// STRINGS and CHARACTERS
//
// In memory, all data is expressed in BYTES.
// ∙ One byte is 8 bits.   Ex: 01001010.
// ∙ One bit is 0 or 1.    Ex: 0
// ∙ One nibble is 4 bits. Ex: 0100
//
// Character is one byte.
// A byte is a integer from 0 to 255  (00000000 to 11111111).

int main(int argc, char* argv[]) {

    char ch = 'A';
    printf("ch == '%c'\n", ch);  // character literal
    printf("ch == %d\n",   ch);  // integer literal in decimal notation
    printf("ch == 0x%x\n", ch);  // integer literal in hexadecimal notation
    printf("ch == 0%o\n",  ch);  // integer literal in octal notation
    
    return EXIT_SUCCESS;
}
/* vim: set tabstop=4 shiftwidth=4 fileencoding=utf-8 noexpandtab: */

© Copyright 2021 Alexander J. Quinn         This content is protected and may not be shared, uploaded, or distributed.