Book = C/C++ Programming (Hanbit Media)
C procedural/structured language
C++ object-oriented language
- Chapter Index -
ch2. Variables -(expands to)-> ch4 Arrays
ch6,7 Data sorting (bubble sort) (stack/queue/linked list): data structures
ch5 Pointers (scope)
ch8 Scope/lifetime: when memory is allocated and when it is cleared
: memory -(data)-> register -> ALU operations (-> register) -> deletion
ch9 Typedef: coding to make names shorter and easier to identify through renaming
Structures: grouping individual pieces of data together
ch11 Conditional compilation
ch15 Objects (C++)
ch5 Pointers (scope)
ch8 Scope/lifetime: when memory is allocated and when it is cleared
: memory -(data)-> register -> ALU operations (-> register) -> deletion
ch9 Typedef: coding to make names shorter and easier to identify through renaming
Structures: grouping individual pieces of data together
ch11 Conditional compilation
ch15 Objects (C++)
<50.p>
Data -(processing)-> Information
C = good portability
Interpreted language: translate and execute one line at a time
Compiled language: translate the whole program and then execute it (compile `F7` / run `Ctrl+F5`)
< 37.p >
#include <stdio standard input/output .h> = preprocessor directive (runs before compilation)
include means a header where functions have already been defined and installed for compilation
int (integer / return type / the type returned when the program ends) main() `main` can be declared only once.
{
printf("hello"); If you wrote `print("hello");` instead, it would cause a "link error."
because the library function defined in the header file cannot be found.
because the library function defined in the header file cannot be found.
Who brings in the function? = the linker
Function composition/order = 1. Prototype: `stdio.h`
2. Call: the contents inside `{}`
3. Definition: the linker brings it in and executes it (library concept)
Function composition/order = 1. Prototype: `stdio.h`
2. Call: the contents inside `{}`
3. Definition: the linker brings it in and executes it (library concept)
return 0; / when a return type has been declared
the operating system that receives it decides whether the program ended normally or abnormally.
the operating system that receives it decides whether the program ended normally or abnormally.
}
< 60.p >
A = 10
C = 12 = 1100
F = 15 = 1111
ex)
< 60.p >
A = 10
C = 12 = 1100
F = 15 = 1111
ex)
0X8D (h) = 141 (d) = 100011101 (b)
0x57 (h) = 01010111 In hexadecimal, one digit = 4 bits = a nibble, so `5 = 0101`, `7 = 0111`
135 (d) = 0x87 (h) = 10000111 (b) The leading `1` is the MSB = most significant bit = sign bit
The last `1` is the LSB = least significant bit
The last `1` is the LSB = least significant bit
int = 4 bytes
ch = 1 byte = 8 bits
0111 1111 = +127
1000 0000 = -128
0111 1111 = -127
1000 0000 = -128
0111 1111 = -127
< 61.p >
Character data type
char = data type for representing one character = 8 bits = 256 possible cases = -128 ~ -1, 0 ~ +127
(`unsigned char` has 255 possible cases.)
Numeric data types
int / long = integer data type = 4 bytes (recently promoted)
float / double = floating-point data type
< 62.p > ASCII code
A = 0X41
a = 0X61
LF = 0X0A = 10 line-feed character = `\n` = move to the next line
CR = 0X0D = move the cursor to the first position `\r`
NUL = 0
ex) Example of LF ( `... + \n` ) Example of CR ( `... + \n\r` )
< 62.p > ASCII code
A = 0X41
a = 0X61
LF = 0X0A = 10 line-feed character = `\n` = move to the next line
CR = 0X0D = move the cursor to the first position `\r`
NUL = 0
ex) Example of LF ( `... + \n` ) Example of CR ( `... + \n\r` )
abcd abcd
efgh efgh
< 73.p > Representing negative integers using complements
< 78.p > Escape sequences
/a bell sound /b move back one character /t move by one horizontal tab
/n line break /f move to the next page /r move to the start of the current line
/" /' /? // put `/` in front to use symbols as characters
/0 null character /000 3-digit octal character /xhhh the character `x` followed by a 3-digit hexadecimal value
