C-2: Memory & Understanding
ใน C-1 คุณเห็นว่าข้อมูลเก็บเป็น bytes — แต่ bytes เหล่านั้นเก็บ ที่ไหน? ใครเป็นคนบอกว่า “จบตรงนี้”? และทำไมการรู้สิ่งนี้ถึงทำให้คุณเข้าใจทุกเครื่องมืออื่น?
Learning Flow
Section titled “Learning Flow”Learning Goals
Section titled “Learning Goals”- เข้าใจ pointers: & (address-of) และ * (dereference) — กุญแจสู่ memory
- เข้าใจ null terminator (\0) ในระดับลึก — ทำไม sizeof ไม่เท่า strlen
- อธิบายได้ว่าทำไม VARCHAR ถึงมี — เพราะ string ใน C ไม่รู้ความยาวตัวเอง
- เชื่อมโยง C กับ SQL, Python, Sheets — ทุกเครื่องมือสร้างจาก concepts เดียวกัน
Progress 0 / 4
ทำไมต้องเรียนเรื่อง Memory?
Section titled “ทำไมต้องเรียนเรื่อง Memory?”ทุก byte ในหน่วยความจำมี address — เหมือนบ้านทุกหลังมีเลขที่ Pointer คือตัวแปรที่เก็บ address นี้
แผนที่ความเชื่อมโยง
Section titled “แผนที่ความเชื่อมโยง”| C Concept | SQL | Python | Sheets |
|---|---|---|---|
pointer (*p) | foreign key | reference/variable | cell reference (=A1) |
&x (address) | primary key | id(x) | cell address (A1) |
\0 terminator | VARCHAR length prefix | len() tracking | LEN() |
sizeof | storage size | sys.getsizeof | ไม่มี equivalent |
บทเรียน
Section titled “บทเรียน” C-2.1 Pointers & (address-of) และ * (dereference) — ข้อมูลอยู่ที่ไหนในหน่วยความจำ
C-2.2 String Termination null terminator \\0 — ทำไม sizeof('HI') = 3 ไม่ใช่ 2 และ VARCHAR มาจากไหน
C-2.3 Why C Explains Everything สรุปทั้งหมด: ทุก SQL type = C type + กฎ, Python ซ่อน bytes, Sheets ซ่อนทุกอย่าง
Lab: Trace Memory ตามรอยค่าเดียวผ่าน char, int, hex, binary — เห็นทุกมุมมอง