---
id: c-for-loop-reallife
title: "C For Loop Examples"
category: "Programming_Language"
status: "draft"
verification_status: "conceptual"
canonical_id: ""
aliases: ["powers of 2", "multiplication table generator", "C for 루프 실전 예제"]
duplicate_of: ""
source_trust_level: "B"
confidence_score: 0.83
created_at: 2026-07-04
updated_at: 2026-07-04
review_reason: ""
merge_history: []
tags: ["c", "programming-language", "w3schools", "loops", "for-loop", "real-life-example"]
raw_sources: ["https://www.w3schools.com/c/c_for_loop_reallife.php"]
applied_in: []
github_commit: ""
---

# [[C For Loop Examples]]

## 🎯 한 줄 통찰 (One-line insight)
The powers-of-2 example (`for (i = 2; i <= 512; i *= 2)`) shows the third `for` expression isn't limited to addition or subtraction — MULTIPLICATIVE stepping works identically, meaning the "increment expression" slot in a for loop is really just "any expression that changes the loop variable," and the loop condition (`i <= 512`) naturally still governs when it stops regardless of HOW the variable changes each time. [S1]

## 🧠 핵심 개념 (Core concepts)
- **Additive stepping by an arbitrary amount** — `i += 10` steps by tens; not restricted to `i++`/`i--`. [S1]
- **Multiplicative stepping** — `i *= 2` doubles the value each iteration, producing powers of 2 rather than an arithmetic sequence. [S1]
- **Parameterized multiplication table** — using a variable (`number`) instead of a hardcoded value lets the SAME loop generate any number's table. [S1]

## 📖 세부 내용 (Details)
- Counting by tens: `for (i = 0; i <= 100; i += 10) { printf("%d\n", i); }`. [S1]
- Odd numbers only: `for (i = 1; i < 10; i = i + 2) { printf("%d\n", i); }`. [S1]
- Powers of 2 via multiplicative stepping: `for (i = 2; i <= 512; i *= 2) { printf("%d\n", i); }` — 2, 4, 8, 16, ..., 512. [S1]
- Parameterized multiplication table: `int number = 2; int i; for (i = 1; i <= 10; i++) { printf("%d x %d = %d\n", number, i, number * i); }`. [S1]

## ⚖️ 모순 및 업데이트 (Contradictions & updates)
- **증가식은 곱셈도 가능**: for 루프의 세 번째 표현식이 i++나 i+=N 뿐 아니라 i *= 2처럼 곱셈으로도 구성될 수 있다는 점이 확인되며, 2의 거듭제곱 수열 생성에 활용됨. [S1]

## 🛠️ 적용 사례 (Applied in summary)
2의 거듭제곱을 512까지 출력하는 예제와, 임의의 숫자(number 변수)에 대한 구구단표를 생성하는 예제가 원문에서 직접 실전 활용 사례로 제시됨. [S1]

## 💻 코드 패턴 (Code patterns)
Multiplicative stepping in a for loop to generate powers of 2 (C):
```c
for (i = 2; i <= 512; i *= 2) {
  printf("%d\n", i);
}
// 2, 4, 8, 16, 32, 64, 128, 256, 512
```

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

## 🔗 지식 그래프 (Knowledge Graph)
- **상위/루트:** [[C Tutorial]]
- **관련 개념:** [[C For Loop Nested]], [[C Break Continue]]
- **참조 맥락:** for 루프 실전 예제 — break/continue 챕터로 이어짐.

## 📚 출처 (Sources)
- [S1] W3Schools — C For Loop Examples — https://www.w3schools.com/c/c_for_loop_reallife.php

## 📝 변경 이력 (Change history)
- 2026-07-04: Initial draft synthesized from the W3Schools "C For Loop Examples" page (Astra wiki-curation, P-Reinforce v3.1 format).
