C 언어
cppreference.com
< c
C 언어 구조의 간단한 참조 입니다.
목차 |
[편집] 일반 주제
[편집] 전처리기
[편집] 주석
[편집] 키워드
[편집] ASCII 표
[편집] 이스케이프 문자열(Escape sequences)
[편집] C 의 역사
[편집] 흐름 제어
[편집] 조건절
주어진 식의 값에 따라 다른 코드 흐름(code paths)이 실행된다.
[편집] 반복문
동일한 코드가 수차례 실행된다.
[편집] 분기문
다른 지점에서 실행을 재개한다.
- continue 루프문의 몸체(enclosing loop body)에서 나머지 부분을 지나친다.
- break 현재 코드를 둘러 싸고 있는 루프를 종료한다.
- goto 다른 지점의 코드로 가 실행을 지속한다.
- return 현재 코드를 둘러 싸고 있는 함수의 실행을 종료한다.
[편집] 함수
동일한 코드는 프로그램의 서로 다른 위치에서 재사용 될 수 있다.
- 함수 선언 함수를 선언한다.
- 인라인(inline) 지정자 컴파일러가 함수의 몸체를 호출 코드부분에 바로 삽입하게끔 하는 방법.
[편집] 타입
- 기본 타입 기본적인 문자, 숫자 그리고 소수점 형식을 정의한다.
- 포인터 메모리 위치를 갖고 있다.
- 구조체 여러 데이터 멤버를 갖는 타입을 정의한다.
- 열거형 특정 값만을 갖는 타입을 정의한다.
- 공용체 여러 형태로 표현되는 데이터를 갖는 타입을 정의한다.
- 함수 인자와 반환 타입을 통해 함수의 호출 형식을 정의한다.
[편집] 지정자
- cv(const, volatility) 지정자 타입의 상수성(constness)과 최적화 금지(volatility)를 지정한다.
- 저장등급(storage class) 지정자 타입의 연결방식(linkage)과 지속성(storage duration)을 지정한다.
- alignas specifier specifies that the storage for the variable should be aligned by specific amount (since C99)
- function specifiers specifies how the compiler should handle a function (since C99)
[편집] Literals
Literals are the tokens of a C program that represent constant values, embedded in the source code.
- integer literals are decimal, octal, or hexadecimal numbers of integer type.
- character literals are individual characters of type char, char16_t, char32_t, or wchar_t.
- floating-point literals are values of type float, double, or long double
- string literals are sequences of characters, which may be narrow, multibyte, or wide.
- boolean literals are values of type bool, that is true and false (since C99)
- user-defined literals are constant values of user-specified type (since C99)
[편집] 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 |
+a |
!a |
a == b |
a[b] |
a(...) |
- operator precedence the order in which operators are bound to their arguments
- alternative representations alternative spellings for some of the operators
[편집] Utilities
- Types
- typedef declaration creates a synonym for a type
- attributes defines additional information about variable (since C99)
- Casts
- standard conversions implicit conversions from one type to another