docs(10_Wiki): 위키 구조 정리 — 언어 튜토리얼 카테고리 폴더 제거 + 신규 자산 동기화

Topic_CSS/Topic_HTML/Topic_JavaScript/Topic_Prompt/Topic_Comfyui 등 기존 카테고리 폴더를 정리하고,
Topic_Graphic/Dev 등 신규 산출물과 Topics 내부 세션/메모리 기록을 동기화.
This commit is contained in:
Antigravity Agent
2026-07-05 00:10:59 +09:00
parent a397bc4720
commit 1cfd3bbb56
1495 changed files with 68534 additions and 27 deletions
+70
View File
@@ -0,0 +1,70 @@
---
id: c-do-while-loop
title: "C Do/While Loop"
category: "Programming_Language"
status: "draft"
verification_status: "conceptual"
canonical_id: ""
aliases: ["do while", "at-least-once loop", "scanf input validation loop", "C do-while 반복문"]
duplicate_of: ""
source_trust_level: "B"
confidence_score: 0.86
created_at: 2026-07-04
updated_at: 2026-07-04
review_reason: ""
merge_history: []
tags: ["c", "programming-language", "w3schools", "loops", "do-while"]
raw_sources: ["https://www.w3schools.com/c/c_do_while_loop.php"]
applied_in: []
github_commit: ""
---
# [[C Do/While Loop]]
## 🎯 한 줄 통찰 (One-line insight)
The core difference from a regular `while` loop isn't cosmetic syntax — it's WHEN the condition is checked: `do/while` runs the body FIRST and evaluates the condition only AFTER, guaranteeing at least one execution even if the condition is false from the very start (`int i = 10; do {...} while (i < 5);` still runs once), which is exactly the opposite of the plain `while` loop's zero-iteration behavior shown in the previous chapter. [S1]
## 🧠 핵심 개념 (Core concepts)
- **`do { ... } while (condition);`** — executes the block ONCE unconditionally, then checks the condition to decide whether to repeat. [S1]
- **Guaranteed first execution** — unlike `while`, the body runs at least once even if the condition is false immediately. [S1]
- **Use case: "at least once" behavior** — ideal for scenarios like showing a message or prompting for user input, where the action must happen before any condition can even be evaluated. [S1]
- **Input-validation pattern** — repeatedly prompting via `scanf()` until the user provides a value that fails the loop condition (e.g. entering 0 or negative to stop). [S1]
## 📖 세부 내용 (Details)
- Standard case (condition true at start): `int i = 0; do { printf("%d\n", i); i++; } while (i < 5);`. [S1]
- Guaranteed-once case (condition false at start): `int i = 10; do { printf("i is %d\n", i); i++; } while (i < 5);` — still prints once despite `i < 5` being false immediately. [S1]
- Practical input-validation loop: `int number; do { printf("Enter a positive number: "); scanf("%d", &number); } while (number > 0);` — keeps prompting until 0 or a negative number is entered. [S1]
## ⚖️ 모순 및 업데이트 (Contradictions & updates)
- **do/while은 조건과 무관하게 최소 1회 실행**: 일반 while 루프는 조건이 처음부터 거짓이면 아예 실행되지 않지만, do/while은 조건이 거짓이어도 반드시 한 번은 실행된다는 점이 직접 대비되어 강조됨. [S1]
## 🛠️ 적용 사례 (Applied in summary)
사용자로부터 양수를 입력받되 0이나 음수가 입력될 때까지 반복해서 물어보는 입력 검증 루프가 원문에서 직접 실전 활용 사례로 제시됨. [S1]
## 💻 코드 패턴 (Code patterns)
An input-validation loop that must prompt at least once before checking the exit condition (C):
```c
int number;
do {
printf("Enter a positive number: ");
scanf("%d", &number);
} while (number > 0);
```
## ✅ 검증 상태 및 신뢰도
- **상태:** draft
- **검증 단계:** conceptual
- **출처 신뢰도:** B (W3Schools — widely used educational reference, not a primary standards body)
- **신뢰 점수:** 0.86
- **중복 검사 결과:** 신규 생성 (New discovery)
## 🔗 지식 그래프 (Knowledge Graph)
- **상위/루트:** [[C Tutorial]]
- **관련 개념:** [[C While Loop RealLife]], [[C For Loop]], [[C User Input]]
- **참조 맥락:** while 루프의 변형 — for 루프(For Loop) 챕터로 이어짐, 사용자 입력(User Input) 챕터와 연결.
## 📚 출처 (Sources)
- [S1] W3Schools — C Do/While Loop — https://www.w3schools.com/c/c_do_while_loop.php
## 📝 변경 이력 (Change history)
- 2026-07-04: Initial draft synthesized from the W3Schools "C Do/While Loop" page (Astra wiki-curation, P-Reinforce v3.1 format).