--- id: c-variables-change title: "C Variable Values" category: "Programming_Language" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: ["reassignment", "self-referential assignment", "C 변수 값 변경"] duplicate_of: "" source_trust_level: "B" confidence_score: 0.84 created_at: 2026-07-04 updated_at: 2026-07-04 review_reason: "" merge_history: [] tags: ["c", "programming-language", "w3schools", "variables", "assignment"] raw_sources: ["https://www.w3schools.com/c/c_variables_change.php"] applied_in: [] github_commit: "" --- # [[C Variable Values]] ## 🎯 한 줄 통찰 (One-line insight) `x = x + 1` is explicitly explained not as a mathematical equation (which would be false — x can never equal x+1) but as an INSTRUCTION: "take the current value of x and add 1 to it, [then store the result back into x]" — a reframing crucial for anyone whose intuition for `=` comes from algebra rather than programming's assignment semantics. [S1] ## 🧠 핵심 개념 (Core concepts) - **Reassignment overwrites** — assigning a new value to an existing variable replaces the old value entirely; this is normal/expected behavior, not an error. [S1] - **Variable-to-variable copying** — `myNum = myOtherNum;` copies the CURRENT value of one variable into another; the two remain independent afterward (no live link). [S1] - **Copying into a previously-unassigned variable** — a variable declared without an initial value can still receive a value via copy-assignment later. [S1] - **Self-referential assignment (`x = x + 1`)** — reads the current value of `x`, computes `x + 1`, and stores the result back into `x`; this is an instruction/mutation, not an algebraic equality. [S1] ## 📖 세부 내용 (Details) - Simple reassignment: `int myNum = 15; myNum = 10; // Now myNum is 10`. [S1] - Variable-to-variable copy: `int myNum = 15; int myOtherNum = 23; myNum = myOtherNum; // myNum is now 23`. [S1] - Adding two variables into a third: `int x = 5; int y = 6; int sum = x + y;`. [S1] - Self-referential update: `int x = 5; x = x + 1; // x is now 6`. [S1] ## ⚖️ 모순 및 업데이트 (Contradictions & updates) - **= 기호는 수학적 등식이 아님**: x = x + 1이 대수적으로는 성립할 수 없는 식이지만, 프로그래밍에서는 "현재 x값에 1을 더해 다시 x에 저장하라"는 명령으로 해석되어야 한다는 점이 명시적으로 설명됨. [S1] ## 🛠️ 적용 사례 (Applied in summary) 현재 발견된 실제 적용 사례가 없습니다 — x = x + 1 패턴이 이후 반복문(Loops) 챕터에서 카운터 증가 로직의 기초가 된다. [S1] ## 💻 코드 패턴 (Code patterns) Self-referential assignment — reading and updating the same variable (C): ```c int x = 5; x = x + 1; // x is now 6 printf("%d", x); ``` ## ✅ 검증 상태 및 신뢰도 - **상태:** draft - **검증 단계:** conceptual - **출처 신뢰도:** B (W3Schools — widely used educational reference, not a primary standards body) - **신뢰 점수:** 0.84 - **중복 검사 결과:** 신규 생성 (New discovery) ## 🔗 지식 그래프 (Knowledge Graph) - **상위/루트:** [[C Tutorial]] - **관련 개념:** [[C Variables Names]], [[C Variables Multiple]], [[C While Loop]] - **참조 맥락:** 변수 값 변경과 재대입 — 여러 변수 한번에 선언하기(Variables Multiple) 챕터로 이어짐. ## 📚 출처 (Sources) - [S1] W3Schools — C Variable Values — https://www.w3schools.com/c/c_variables_change.php ## 📝 변경 이력 (Change history) - 2026-07-04: Initial draft synthesized from the W3Schools "C Variable Values" page (Astra wiki-curation, P-Reinforce v3.1 format).