User Tools

Site Tools


notes:data

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
notes:data [2017/09/26 13:02] – [week 2] ahought2notes:data [2018/10/04 01:24] – [URLs] ktodd3
Line 1: Line 1:
-======Data Structures Course Notes======+<WRAP centeralign round box> 
 +<WRAP><color red><fs 200%>Corning Community College</fs></color></WRAP> 
 +<WRAP><fs 150%>CSCS2320 Data Structures</fs></WRAP> 
 +<fs 125%>Course Wiki Page</fs> 
 +</WRAP>
  
-=====week 1=====+======Projects====== 
 +dsi0 
 +ael0 
 +======URLs====== 
 +Binky Pointer Video: 
 +https://www.youtube.com/watch?v=f-pJlnpkLp0
  
-=====week 2===== +[[https://www.learn-c.org/en/Linked_lists]]Basic linked list tutorial  
-Nodes are structures that contain data and also can point and "link" to another node, creating a list.+======Notes====== 
 +====Pointers:====
  
-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&tmp)+char x = 0;
  
-Ternary statements= "(condition? statementiftrue : statementiffalse;"+char -> 1 byte (8 bits) 
 +Default char -> signed (2^8 -> 256 -> -128, +127 [one is used for positive/negative value])
  
-To free memory: use free() then set to null ex: free(tmp); tmp = NULL;+the asterisk (*indicates a "pointer" 
 +    signed char *y = NULL; 
 +                ^ 
 +                                 
 +(void*)
 +Void pointers are raw memory
  
 +    |0|
 +    ---
 +    x
 +    0xdeadbeef
 +       |NULL(0)|
 +       ---------
 +       y
 +       0xcoffee
 +       
 +Access an address with &
  
-=====I dunno lol===== +Make y deadbeef without using "deadbeefby using the address (&my man.
-"Listin sll0 is just an "engine" and "caboose", which are pointers (like tmpto "start" and "end", therefore "mklist()" is super easy to use+
  
-=====whaaat===== +   &x 
---i increments before loopi-- increments after first iteration+Nowy's data is the address of x.
  
 +x contains the data '0'
 +
 +If we do this:
 +    |0|
 +    ---
 +    x
 +    0xdeadbeef  <- address
 +       |0xdeadbeef|
 +       ------------
 +       y
 +       0xcoffee <- address
 +       
 +   x = 7;
 +   *y = 13;
 +
 +Then:
 +    |13|
 +    ----
 +    x
 +    0xdeadbeef  <- address
 +       |0xdeadbeef|
 +       ------------
 +       y
 +       0xcoffee <- address
 +
 +x is now 13 because y is x's address, and you 'pointed' 13 to the address. Ill, dog.
 +
 +
 +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.txt · Last modified: 2018/10/25 03:39 by ktodd3