--- id: cpp-pointers-dereference title: "C++ Dereference" category: "Programming_Language" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: ["dereference operator", "* dual meaning", "C++ μ—­μ°Έμ‘°"] duplicate_of: "" source_trust_level: "B" confidence_score: 0.85 created_at: 2026-07-04 updated_at: 2026-07-04 review_reason: "" merge_history: [] tags: ["cpp", "programming-language", "w3schools", "pointers", "dereference"] raw_sources: ["https://www.w3schools.com/cpp/cpp_pointers_dereference.asp"] applied_in: [] github_commit: "" --- # [[CPP Dereference]] ## 🎯 ν•œ 쀄 톡찰 (One-line insight) The `*` symbol does two OPPOSITE jobs depending on where it appears β€” identical to C's pointer chapter β€” in a declaration (`string* ptr`) it CREATES a pointer, but everywhere else (`*ptr`) it DEREFERENCES one to retrieve the pointed-to value, confirming C++ inherited this exact dual-meaning confusion point from C without modification. [S1] ## 🧠 핡심 κ°œλ… (Core concepts) - **`*` in declaration vs. elsewhere** β€” `string* ptr;` creates a pointer variable; `*ptr` (outside declaration) dereferences it to get the pointed-to value. [S1] - **Reference (`&`) vs. dereference (`*`)** β€” `ptr` alone gives the address; `*ptr` gives the value. [S1] ## πŸ“– μ„ΈλΆ€ λ‚΄μš© (Details) - Reference vs. dereference side by side: `string food = "Pizza"; string* ptr = &food; cout << ptr; // 0x6dfed4 (address) cout << *ptr; // Pizza (value)`. [S1] ## βš–οΈ λͺ¨μˆœ 및 μ—…λ°μ΄νŠΈ (Contradictions & updates) - **`*`의 이쀑 μ˜λ―Έκ°€ C와 λ™μΌν•˜κ²Œ 확인됨**: μ„ μ–Έμ—μ„œλŠ” 포인터λ₯Ό λ§Œλ“€κ³ , 선언이 μ•„λ‹Œ κ³³μ—μ„œλŠ” μ—­μ°Έμ‘° μ—°μ‚°μžλ‘œ λ™μž‘ν•œλ‹€λŠ” ν˜Όλ™ μš”μ†Œκ°€ C 챕터와 μ™„μ „νžˆ 동일함. [S1] ## πŸ› οΈ 적용 사둀 (Applied in summary) ν˜„μž¬ 발견된 μ‹€μ œ 적용 사둀가 μ—†μŠ΅λ‹ˆλ‹€ β€” μ—­μ°Έμ‘° μ—°μ‚°μžλ₯Ό μ΄μš©ν•΄ 포인터가 κ°€λ¦¬ν‚€λŠ” λ³€μˆ˜μ˜ 값을 직접 λ³€κ²½ν•˜λŠ” 것이 λ‹€μŒ 챕터(Modify Pointers)μ—μ„œ μ‹€μ „ ν™œμš©μœΌλ‘œ 이어진닀. [S1] ## πŸ’» μ½”λ“œ νŒ¨ν„΄ (Code patterns) Reference vs. dereference on the same pointer (C++): ```cpp string food = "Pizza"; string* ptr = &food; cout << ptr << "\n"; // Reference: memory address of food cout << *ptr << "\n"; // Dereference: value of food (Pizza) ``` ## βœ… 검증 μƒνƒœ 및 신뒰도 - **μƒνƒœ:** draft - **검증 단계:** conceptual - **좜처 신뒰도:** B (W3Schools β€” widely used educational reference, not a primary standards body) - **μ‹ λ’° 점수:** 0.85 - **쀑볡 검사 κ²°κ³Ό:** μ‹ κ·œ 생성 (New discovery) ## πŸ”— 지식 κ·Έλž˜ν”„ (Knowledge Graph) - **μƒμœ„/루트:** [[C++ Tutorial]] - **κ΄€λ ¨ κ°œλ…:** [[CPP Pointers]], [[CPP Pointers Modify]], [[C Pointers]] - **μ°Έμ‘° λ§₯락:** μ—­μ°Έμ‘° β€” 포인터 κ°’ μˆ˜μ •(Pointers Modify) μ±•ν„°λ‘œ 이어짐. ## πŸ“š 좜처 (Sources) - [S1] W3Schools β€” C++ Dereference β€” https://www.w3schools.com/cpp/cpp_pointers_dereference.asp ## πŸ“ λ³€κ²½ 이λ ₯ (Change history) - 2026-07-04: Initial draft synthesized from the W3Schools "C++ Dereference" page (Astra wiki-curation, P-Reinforce v3.1 format).