가장 많이 묻는 면접 질문과 답변 & 온라인 테스트
면접 준비, 온라인 테스트, 튜토리얼, 라이브 연습을 위한 학습 플랫폼

집중 학습 경로, 모의고사, 면접 준비 콘텐츠로 실력을 키우세요.

WithoutBook은 주제별 면접 질문, 온라인 연습 테스트, 튜토리얼, 비교 가이드를 하나의 반응형 학습 공간으로 제공합니다.

Chapter 2

Syntax, Variables, Data Types, Constants, and Input Output

Learn the basic syntax of C programs, primitive data types, variable declarations, constants, formatting, and console input-output.

Inside this chapter

  1. Basic Syntax Rules
  2. Primitive Data Types
  3. Declaring Variables and Constants
  4. Formatted Output and Input
  5. Format Specifiers
  6. Real-World Usage Snapshot

Series navigation

Study the chapters in order for the clearest path from C basics to advanced memory, systems, debugging, and real-world development practice. Use the navigation at the bottom of each page to move smoothly through the full tutorial.

Tutorial Home

Chapter 2

Basic Syntax Rules

C is case-sensitive. Statements usually end with semicolons. Blocks are defined using braces. Variables must be declared before use. Unlike some higher-level languages, C expects the programmer to be precise about types and storage.

Chapter 2

Primitive Data Types

Type Typical Usage
intWhole numbers
charSingle character or small integer byte value
floatSingle-precision floating-point
doubleDouble-precision floating-point
longLarger integer range depending on platform

Type size can depend on platform and compiler, so students should focus first on meaning and usage, then later on exact memory-level implications.

Chapter 2

Declaring Variables and Constants

int age = 21;
double price = 49.99;
char grade = 'A';
const int DAYS_IN_WEEK = 7;

const expresses intent clearly and helps prevent accidental modification.

Chapter 2

Formatted Output and Input

#include <stdio.h>

int main(void) {
    int age;
    printf("Enter your age: ");
    scanf("%d", &age);
    printf("You entered: %d\n", age);
    return 0;
}

printf and scanf are fundamental, but beginners must be careful with format specifiers and addresses. The & operator in scanf is one of the first hints that C deals directly with memory addresses.

Chapter 2

Format Specifiers

  • %d for int
  • %f for float and double in printf
  • %c for char
  • %s for strings
  • %ld for long
Chapter 2

Real-World Usage Snapshot

Even experienced engineers working with advanced systems still rely on clear understanding of primitive types, input-output formatting, and type discipline. Bugs in these basics can lead to wrong calculations, crashes, or undefined behavior later.

Copyright © 2026, WithoutBook.