--- id: c-syntax title: "C Syntax" category: "Programming_Language" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: ["main function", "include stdio", "C 문법"] 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", "syntax"] raw_sources: ["https://www.w3schools.com/c/c_syntax.php"] applied_in: [] github_commit: "" --- # [[C Syntax]] ## 🎯 ν•œ 쀄 톡찰 (One-line insight) The compiler is explicitly indifferent to whitespace and line breaks β€” the source shows the ENTIRE `main()` body collapsible onto a single line (`int main(){printf("Hello World!");return 0;}`) and produces identical behavior β€” meaning C's multi-line formatting convention exists purely for human readability, not because the language requires it, unlike languages where indentation/newlines are syntactically meaningful. [S1] ## 🧠 핡심 κ°œλ… (Core concepts) - **`#include `** β€” includes a header enabling input/output functions like `printf()`; described as something that "almost always appears" in a C program. [S1] - **`main()`** β€” the special function where program execution begins; code inside its `{}` is what actually runs. [S1] - **Statement termination** β€” every C statement must end with a semicolon `;`. [S1] - **`return 0`** β€” ends `main()` and sends a value back to the operating system; `0` conventionally signals "everything worked." [S1] - **Whitespace insignificance** β€” blank lines and extra spaces are ignored by the compiler; used only to aid human readability. [S1] ## πŸ“– μ„ΈλΆ€ λ‚΄μš© (Details) - Standard multi-line form: `#include int main() { printf("Hello World!"); return 0; }`. [S1] - Equivalent single-line form (compiler behaves identically): `int main(){printf("Hello World!");return 0;}`. [S1] ## βš–οΈ λͺ¨μˆœ 및 μ—…λ°μ΄νŠΈ (Contradictions & updates) - **μ€„λ°”κΏˆ/곡백은 μˆœμ „νžˆ 가독성 λͺ©μ **: μ»΄νŒŒμΌλŸ¬κ°€ μ—¬λŸ¬ μ€„λ‘œ 쓰인 μ½”λ“œμ™€ ν•œ μ€„λ‘œ μ••μΆ•ν•œ μ½”λ“œλ₯Ό λ™μΌν•˜κ²Œ μ²˜λ¦¬ν•œλ‹€λŠ” 점이 직접적인 μ½”λ“œ λΉ„κ΅λ‘œ 증λͺ…됨. [S1] ## πŸ› οΈ 적용 사둀 (Applied in summary) ν˜„μž¬ 발견된 μ‹€μ œ 적용 사둀가 μ—†μŠ΅λ‹ˆλ‹€ β€” 이 μ±•ν„°μ˜ λ¬Έμž₯ λ‹¨μœ„ λΆ„ν•΄ μ„€λͺ…이 이후 λͺ¨λ“  C μ½”λ“œλ₯Ό μ½λŠ” 기초 독해 λŠ₯λ ₯의 ν† λŒ€κ°€ λœλ‹€. [S1] ## πŸ’» μ½”λ“œ νŒ¨ν„΄ (Code patterns) The canonical C program structure, annotated line by line: ```c #include int main() { printf("Hello World!"); return 0; } ``` ## βœ… 검증 μƒνƒœ 및 신뒰도 - **μƒνƒœ:** draft - **검증 단계:** conceptual - **좜처 신뒰도:** B (W3Schools β€” widely used educational reference, not a primary standards body) - **μ‹ λ’° 점수:** 0.86 - **쀑볡 검사 κ²°κ³Ό:** μ‹ κ·œ 생성 (New discovery) ## πŸ”— 지식 κ·Έλž˜ν”„ (Knowledge Graph) - **μƒμœ„/루트:** [[C Tutorial]] - **κ΄€λ ¨ κ°œλ…:** [[C Get Started]], [[C Statements]] - **μ°Έμ‘° λ§₯락:** C ν”„λ‘œκ·Έλž¨ ꡬ쑰 μ„€λͺ… β€” λͺ…λ Ήλ¬Έ(Statements) μ±•ν„°λ‘œ 이어짐. ## πŸ“š 좜처 (Sources) - [S1] W3Schools β€” C Syntax β€” https://www.w3schools.com/c/c_syntax.php ## πŸ“ λ³€κ²½ 이λ ₯ (Change history) - 2026-07-04: Initial draft synthesized from the W3Schools "C Syntax" page (Astra wiki-curation, P-Reinforce v3.1 format).