1cfd3bbb56
Topic_CSS/Topic_HTML/Topic_JavaScript/Topic_Prompt/Topic_Comfyui 등 기존 카테고리 폴더를 정리하고, Topic_Graphic/Dev 등 신규 산출물과 Topics 내부 세션/메모리 기록을 동기화.
3.7 KiB
3.7 KiB
id, title, category, status, verification_status, canonical_id, aliases, duplicate_of, source_trust_level, confidence_score, created_at, updated_at, review_reason, merge_history, tags, raw_sources, applied_in, github_commit
| id | title | category | status | verification_status | canonical_id | aliases | duplicate_of | source_trust_level | confidence_score | created_at | updated_at | review_reason | merge_history | tags | raw_sources | applied_in | github_commit | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| c-operators-arithmetic | C Arithmetic Operators | Programming_Language | draft | conceptual |
|
B | 0.86 | 2026-07-04 | 2026-07-04 |
|
|
C Arithmetic Operators
🎯 한 줄 통찰 (One-line insight)
Dividing two int values ALWAYS produces an int result, silently truncating any decimal — 10 / 3 gives 3, not 3.33 — and the ONLY way to get a decimal result is to make at least the operand types float/double (10.0 / 3 gives 3.333...), meaning integer division isn't a rounding behavior to configure, it's an unavoidable consequence of the operand types chosen. [S1]
🧠 핵심 개념 (Core concepts)
- Seven core arithmetic operators —
+(add),-(subtract),*(multiply),/(divide),%(modulus/remainder),++(increment),--(decrement). [S1] - Integer division truncation — dividing two
ints always yields anint, discarding any decimal remainder; usefloat/doubleoperands to get a decimal result. [S1] - Increment/decrement round-trip — incrementing then decrementing the same variable (or vice versa) returns it to its original value. [S1]
📖 세부 내용 (Details)
- All seven operators demonstrated together:
int x = 10; int y = 3; x + y; // 13,x - y; // 7,x * y; // 30,x / y; // 3,x % y; // 1, plus++z/--zon a separate variable. [S1] - Integer vs decimal division contrast:
int a = 10; int b = 3; printf("%d\n", a / b); // 3 (integer division)versusdouble c = 10.0; double d = 3.0; printf("%f\n", c / d); // 3.333.... [S1] - Real-life counting example:
int peopleInRoom = 0; peopleInRoom++; peopleInRoom++; peopleInRoom++; // 3 people enter, count = 3thenpeopleInRoom--; // 1 leaves, count = 2. [S1]
⚖️ 모순 및 업데이트 (Contradictions & updates)
- 정수 나눗셈의 소수점 절삭: int끼리 나누면 항상 int 결과가 나와 소수점이 버려진다는 점이 명시되며, 소수 결과를 원하면 최소 한쪽을 float/double로 만들어야 한다는 해결책이 함께 제시됨. [S1]
🛠️ 적용 사례 (Applied in summary)
방에 들어오고 나가는 사람 수를 ++/--로 세는 카운터 예제가 원문에서 직접 실전 활용 사례로 제시됨. [S1]
💻 코드 패턴 (Code patterns)
Integer division truncates; use float/double operands for a decimal result (C):
int a = 10;
int b = 3;
printf("%d\n", a / b); // Integer division, result is 3
double c = 10.0;
double d = 3.0;
printf("%f\n", c / d); // Decimal division, result is 3.333...
✅ 검증 상태 및 신뢰도
- 상태: draft
- 검증 단계: conceptual
- 출처 신뢰도: B (W3Schools — widely used educational reference, not a primary standards body)
- 신뢰 점수: 0.86
- 중복 검사 결과: 신규 생성 (New discovery)
🔗 지식 그래프 (Knowledge Graph)
- 상위/루트: C Tutorial
- 관련 개념: C Operators, C Operators Assignment
- 참조 맥락: 산술 연산자 — 대입 연산자(Operators Assignment) 챕터로 이어짐.
📚 출처 (Sources)
- [S1] W3Schools — C Arithmetic Operators — https://www.w3schools.com/c/c_operators_arithmetic.php
📝 변경 이력 (Change history)
- 2026-07-04: Initial draft synthesized from the W3Schools "C Arithmetic Operators" page (Astra wiki-curation, P-Reinforce v3.1 format).