notes:data
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
notes:data [2017/09/19 11:46] – [week 3] cmerola2 | notes:data [2018/10/24 23:39] (current) – [URLs] ktodd3 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ======Data Structures Course | + | <WRAP centeralign round box> |
+ | < | ||
+ | < | ||
+ | <fs 125%>Course | ||
+ | </ | ||
- | =====week 1===== | + | ======Projects====== |
+ | dsi0 | ||
+ | ael0 | ||
+ | ======URLs====== | ||
+ | Binky Pointer Video: | ||
- | =====week 2===== | + | [[https:// |
- | Nodes are structures that contain data and also can point and " | + | |
- | Nodes do not necessarily need to be a named variable, but rather can be pointed to by variables that can be moved depending if the list has been changed.(ie. start& | + | [[https:// |
+ | ======Notes====== | ||
+ | ====Pointers: | ||
- | Ternary statements= " | + | char x = 0; |
+ | char -> 1 byte (8 bits) | ||
+ | Default char -> signed (2^8 -> 256 -> -128, +127 [one is used for positive/ | ||
- | =====I dunno lol===== | + | the asterisk |
- | " | + | signed char *y = NULL; |
+ | ^ | ||
+ | |||
+ | (void*)0 | ||
+ | Void pointers are raw memory | ||
+ | |0| | ||
+ | --- | ||
+ | x | ||
+ | 0xdeadbeef | ||
+ | | ||
+ | | ||
+ | y | ||
+ | | ||
+ | |||
+ | Access an address with & | ||
+ | Make y = deadbeef without using " | ||
+ | |||
+ | y = &x | ||
+ | Now, y's data is the address of x. | ||
+ | |||
+ | x contains the data ' | ||
+ | |||
+ | If we do this: | ||
+ | |0| | ||
+ | --- | ||
+ | x | ||
+ | 0xdeadbeef | ||
+ | | ||
+ | | ||
+ | y | ||
+ | | ||
+ | |||
+ | x = 7; | ||
+ | *y = 13; | ||
+ | |||
+ | Then: | ||
+ | |13| | ||
+ | ---- | ||
+ | x | ||
+ | 0xdeadbeef | ||
+ | | ||
+ | | ||
+ | y | ||
+ | | ||
+ | |||
+ | x is now 13 because y is x's address, and you ' | ||
+ | |||
+ | |||
+ | Double pointers are arrays or whatever | ||
+ | | | | ||
+ | ------------ | ||
+ | z | ||
+ | | ||
+ | signed char **z = NULL; | ||
+ | | ||
+ | So we're gonna give this some garbage | ||
+ | |0xcoffee| | ||
+ | ---------- | ||
+ | z | ||
+ | 0xc05fefe | ||
+ | And do nothing with it because we kind of just stopped I think. | ||
+ | | ||
+ | Memory addresses are 8 bytes on 64 bit linux systems. | ||
+ | 4 bytes on 32 bit linux systems. | ||
+ | ======Other====== |
notes/data.1505836002.txt.gz · Last modified: 2017/09/19 11:46 by cmerola2