Namespaces
Variants
Actions

C 언어

From cppreference.com

C 언어 구조의 간단한 참조 입니다.

Contents

일반 주제

전처리기

주석

키워드

ASCII 표

이스케이프 문자열(Escape sequences)

C 의 역사

흐름 제어

조건절

주어진 식의 값에 따라 다른 코드 흐름(code paths)이 실행된다.

  • if 조건적으로 코드를 실행한다.
  • switch 상수 인자 값에 따라 코드를 실행한다.

반복문

동일한 코드가 수차례 실행된다.

  • for 루프(loop)를 실행.
  • while 매회 반복 전에 조건을 체크하며, 루프를 실행.
  • do-while 매회 반복 후에 조건을 체크하며, 루프를 실행.

분기문

다른 지점에서 실행을 재개한다.

  • continue 루프문의 몸체(enclosing loop body)에서 나머지 부분을 지나친다.
  • break 현재 코드를 둘러 싸고 있는 루프를 종료한다.
  • goto 다른 지점의 코드로 가 실행을 지속한다.
  • return 현재 코드를 둘러 싸고 있는 함수의 실행을 종료한다.

함수

동일한 코드는 프로그램의 서로 다른 위치에서 재사용 될 수 있다.

타입

  • 기본 타입 기본적인 문자, 숫자 그리고 소수점 형식을 정의한다.
  • 포인터 메모리 위치를 갖고 있다.
  • 구조체 여러 데이터 멤버를 갖는 타입을 정의한다.
  • 열거형 특정 값만을 갖는 타입을 정의한다.
  • 공용체 여러 형태로 표현되는 데이터를 갖는 타입을 정의한다.
  • 함수 인자와 반환 타입을 통해 함수의 호출 형식을 정의한다.

지정자

Literals

Literals are the tokens of a C program that represent constant values, embedded in the source code.

Expressions

An expression is a sequence of operators and operands that specifies a computation. An expression can result in a value and can cause side effects.

  • order of evaluation of arguments and subexpressions specified the order in which intermediate results are obtained.
  • operators allow the use of syntax commonly found in mathematics
Common operators
assignment increment
decrement
arithmetic logical comparison member
access
other

a = b
a += b
a -= b
a *= b
a /= b
a %= b
a &= b
a |= b
a ^= b
a <<= b
a >>= b

++a
--a
a++
a--

+a
-a
a + b
a - b
a * b
a / b
a % b
~a
a & b
a | b
a ^ b
a << b
a >> b

!a
a && b
a || b

a == b
a != b
a < b
a > b
a <= b
a >= b

a[b]
*a
&a
a->b
a.b

a(...)
a, b
(type) a
a ? b : c
sizeof


_Alignof
(since C11)

Utilities

Types
Casts

Miscellaneous