1cfd3bbb56
Topic_CSS/Topic_HTML/Topic_JavaScript/Topic_Prompt/Topic_Comfyui 등 기존 카테고리 폴더를 정리하고, Topic_Graphic/Dev 등 신규 산출물과 Topics 내부 세션/메모리 기록을 동기화.
69 lines
3.9 KiB
Markdown
69 lines
3.9 KiB
Markdown
---
|
|
id: c-newline
|
|
title: "C New Lines"
|
|
category: "Programming_Language"
|
|
status: "draft"
|
|
verification_status: "conceptual"
|
|
canonical_id: ""
|
|
aliases: ["\\n escape sequence", "blank line", "C 줄바꿈"]
|
|
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", "newline", "escape-sequences"]
|
|
raw_sources: ["https://www.w3schools.com/c/c_newline.php"]
|
|
applied_in: []
|
|
github_commit: ""
|
|
---
|
|
|
|
# [[C New Lines]]
|
|
|
|
## 🎯 한 줄 통찰 (One-line insight)
|
|
`\n` isn't a "print a new line" command — it's an ESCAPE SEQUENCE representing a special character (moving the cursor to the start of the next line), placing it in the same category as `\t`, `\\`, and `\"` from earlier chapters, meaning "printing on multiple lines" in C is really just "printing one string that happens to contain a cursor-movement character," which is why doubling it up (`\n\n`) produces a blank line — the SAME character, repeated, moves the cursor down twice. [S1]
|
|
|
|
## 🧠 핵심 개념 (Core concepts)
|
|
- **`\n`** — an escape sequence that moves the cursor to the beginning of the next line. [S1]
|
|
- **Escape sequence** — a backslash-prefixed representation of a special character that can't be typed directly (this chapter's specific instance of the general pattern from the earlier Special Characters chapter). [S1]
|
|
- **Multiple `\n` in a row = blank line(s)** — since each `\n` moves the cursor down one line, two in a row (`\n\n`) skips an entire visual line. [S1]
|
|
- **Single printf(), multiple lines** — one `printf()` call CAN contain several `\n` characters to produce multi-line output, though the source notes this can hurt readability if overused. [S1]
|
|
|
|
## 📖 세부 내용 (Details)
|
|
- Newline between two separate printf calls: `printf("Hello World!\n"); printf("I am learning C.");`. [S1]
|
|
- Multiple lines from one printf call: `printf("Hello World!\nI am learning C.\nAnd it is awesome!");`. [S1]
|
|
- Producing a blank line with doubled `\n`: `printf("Hello World!\n\n"); printf("I am learning C.");`. [S1]
|
|
- Other common escape sequences reiterated: `\t` (horizontal tab), `\\` (literal backslash), `\"` (literal double quote). [S1]
|
|
|
|
## ⚖️ 모순 및 업데이트 (Contradictions & updates)
|
|
- **\n\n이 빈 줄을 만드는 이유**: \n 하나가 커서를 다음 줄로 한 번 이동시키므로, 두 번 연속 쓰면 한 줄을 건너뛰어 빈 줄처럼 보이게 된다는 점이 확인됨 — 특별한 "빈 줄" 문법이 있는 것이 아니라 동일한 이스케이프 문자의 반복일 뿐. [S1]
|
|
|
|
## 🛠️ 적용 사례 (Applied in summary)
|
|
현재 발견된 실제 적용 사례가 없습니다 — 여러 문장을 하나의 printf() 호출에 \n으로 이어붙이는 것이 코드를 짧게 만들지만 가독성을 해칠 수 있다는 점이 트레이드오프로 언급됨. [S1]
|
|
|
|
## 💻 코드 패턴 (Code patterns)
|
|
Producing a blank line by repeating the newline escape sequence (C):
|
|
```c
|
|
printf("Hello World!\n\n");
|
|
printf("I am learning C.");
|
|
```
|
|
|
|
## ✅ 검증 상태 및 신뢰도
|
|
- **상태:** draft
|
|
- **검증 단계:** conceptual
|
|
- **출처 신뢰도:** B (W3Schools — widely used educational reference, not a primary standards body)
|
|
- **신뢰 점수:** 0.83
|
|
- **중복 검사 결과:** 신규 생성 (New discovery)
|
|
|
|
## 🔗 지식 그래프 (Knowledge Graph)
|
|
- **상위/루트:** [[C Tutorial]]
|
|
- **관련 개념:** [[C Null]], [[C Strings Esc]], [[C Output]]
|
|
- **참조 맥락:** C 튜토리얼 전체의 마지막 챕터 — 출력(Output)과 특수문자(Strings Esc) 챕터의 개념을 마무리로 재확인.
|
|
|
|
## 📚 출처 (Sources)
|
|
- [S1] W3Schools — C New Lines — https://www.w3schools.com/c/c_newline.php
|
|
|
|
## 📝 변경 이력 (Change history)
|
|
- 2026-07-04: Initial draft synthesized from the W3Schools "C New Lines" page (Astra wiki-curation, P-Reinforce v3.1 format).
|