Let us consider in greater detail a few C data types, their memory representations, and their type conversions.
char C programming language!implicit type conversions A char is a single-byte character. If one provides a character literal like 'A', the corresponding byte in memory holds a character code corresponding to A in the machine's character set—most commonly, ASCIIASCII character codes ([@sec:character-codes]). For instance, the seven-bit binary ASCII code for A is 1000001. It is preferable, of course, to use string literals like 'A' in C programming. However, we will occasionally need to manipulate character codes directly. Due to their integer nature, chars can be manipulated via integer arithmetic. For instance,
char x = 'A'; char y; // ASCII character code 65
y …This is a preview. Read the full book in print or ebook — get it from MIT Press (ISBN 9780262548762).
Instructor with access? Instructor login.