Files
2nd/10_Wiki/Topics/Domain_Programming/Topic_C/C_Debugging.md
T
Antigravity Agent c24165b8bc refactor(topics): 멀티 에이전트용 지식 재편 — _Common(공통 기본기) + Domain_* 구조
에이전트 8종(대화형/프로그래머 C·S/디자이너/설계자/기획자/QA/PD/PM)에게
[공통 기본 능력 + 롤별 Specialty] 2층으로 지식을 주입하기 위한 재분류.
문서 내용·포맷은 무수정, 폴더 이동만 (6,372개 문서 수 보존 확인).

- Topic_Programming → Domain_Programming (내부 구조 보존)
- Topic_Graphic → Domain_Design
- Topic_Business → Domain_Product
- Topic_General → Domain_General
- _Common 신설: Math(구 Topic_Math_Specialty), Reasoning(구 General/From_Thinking & Reasoning),
  Reasoning_Creativity(구 General/From_창의성), Communication(Poetic_Blog_Writing + From_writing)
- 타 도메인의 From_* 폴더는 유지 (출처 표기일 뿐, 이미 도메인에 맞게 분류된 문서)
- 빈 폴더 정리 (memory/procedures)
- 에이전트→폴더 매핑은 workspace의 .astra/agent-knowledge-map.json (9개 에이전트)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-11 11:05:56 +09:00

4.5 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-debugging C Debugging Programming_Language draft conceptual
print debugging
breakpoints
debugging vs error handling
C 디버깅
B 0.85 2026-07-04 2026-07-04
c
programming-language
w3schools
debugging
https://www.w3schools.com/c/c_debugging.php

C Debugging

🎯 한 줄 통찰 (One-line insight)

The chapter's closing distinction reframes debugging and error handling as two DIFFERENT PHASES of the same concern, not competing techniques: debugging is about finding/fixing mistakes DURING DEVELOPMENT, while error handling is about gracefully responding to problems WHILE THE PROGRAM RUNS in production — meaning a well-built C program needs both, applied at different times, not one instead of the other. [S1]

🧠 핵심 개념 (Core concepts)

  • Print debugging — sprinkling printf() calls to trace how far execution gets before something goes wrong; if an expected message never prints, the crash happened before that line. [S1]
  • Checking variable values — printing intermediate results to catch LOGIC errors (e.g. expecting 15 but getting 5 reveals a wrong operator, not a crash). [S1]
  • IDE debuggers — breakpoints, line-by-line stepping, and variable-watching, available in IDEs like Visual Studio/Code::Blocks/VS Code; recommended as a step UP from printf() debugging once comfortable with the basics. [S1]
  • Reading error messages literally — the compiler/runtime often states exactly what's wrong and where (e.g. expected ';' before 'printf' → the fix is adding the missing semicolon). [S1]
  • Defensive checks preventing crashes — proactively checking conditions that are KNOWN to cause crashes (e.g. if (y != 0) before dividing, if (index >= 0 && index < 3) before array access) converts a crash into a graceful error message. [S1]

📖 세부 내용 (Details)

  • Print debugging locating a crash point: printf("Before division\n"); int z = x / y; printf("After division\n"); — if "After division" never prints, the crash happened at the division. [S1]
  • Logic-error detection via variable printing: int result = x - y; printf("Result: %d\n", result); // Result: 5 (expected 15 — wrong operator used). [S1]
  • Preventing a divide-by-zero crash with a defensive check: if (y != 0) { int z = x / y; printf("Result: %d\n", z); } else { printf("Error: Division by zero!\n"); }. [S1]
  • Preventing an out-of-bounds crash with a defensive check: if (index >= 0 && index < 3) { printf("Value = %d\n", numbers[index]); } else { printf("Error: Index out of bounds!\n"); }. [S1]

⚖️ 모순 및 업데이트 (Contradictions & updates)

  • 디버깅과 에러 처리는 서로 다른 단계: 디버깅은 개발 중 버그를 찾고 고치는 활동이고, 에러 처리는 프로그램이 실제로 실행되는 중 문제에 대응하는 것이라는 점이 명확히 구분되며, 둘 다 필요하다는 점이 결론으로 제시됨. [S1]

🛠️ 적용 사례 (Applied in summary)

0으로 나누기와 배열 범위 초과 접근이라는 두 가지 대표적 크래시 상황을 사전 조건 검사로 방지하는 방법이 원문에서 직접 실전 활용 사례로 제시됨. [S1]

💻 코드 패턴 (Code patterns)

Preventing a division-by-zero crash with a defensive check instead of a printf-based fix (C):

int x = 10;
int y = 0;
if (y != 0) {
  int z = x / y;
  printf("Result: %d\n", z);
} else {
  printf("Error: Division by zero!\n");
}

검증 상태 및 신뢰도

  • 상태: draft
  • 검증 단계: conceptual
  • 출처 신뢰도: B (W3Schools — widely used educational reference, not a primary standards body)
  • 신뢰 점수: 0.85
  • 중복 검사 결과: 신규 생성 (New discovery)

🔗 지식 그래프 (Knowledge Graph)

📚 출처 (Sources)

📝 변경 이력 (Change history)

  • 2026-07-04: Initial draft synthesized from the W3Schools "C Debugging" page (Astra wiki-curation, P-Reinforce v3.1 format).