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 27 28 29 30 | #include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <assert.h>
// TIP: In a blank file, type "newc" (without quotes) and press Tab to make a skeleton program.
// This is a snippet added for the course and not part of Vim itself.
int main(int argc, char* argv[]) {
int n = 0x6f; // 0x is the prefix that tells the compiler (GCC) that this is base 16 (hexadecimal)
// 6 is the 16's place, and adds 16 x 6 to the value
// f is the 1's place, and adds 1 x 15 to the value
//
// HEXADECIMAL DIGITS
// 0 1 2 3 4 5 6 7 8 9 a b c d e f ← hexadecimal digit
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ← value of digit expressed in decimal
// There are 16 possible digits in base 16 (hexadecimal)
// We can "express" a quantity in a particular base.
// We can "interpret" a written number as a particular base.
// AVOID saying "convert ▒ to base ▒".
//
// A QUANTITY DOES NOT HAVE A BASE.
//
// Base is only relevant when a quantity is written. Base is a 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.