Skip to content

C:ptrdiff t

Result of pointer subtraction.

Alias of one of the fundamental signed integer types.

It is a type able to represent the result of any valid pointer subtraction operation.

A pointer subtraction is only guaranteed to have a valid defined value for pointers to elements of the same array (or for the element just past the last in the array).

Visual Studio comment

ANSI 3.3.6, 4.1.1 같은 배열 ptrdiff_t의 요소에 대한 두 포인터 사이의 차이를 수용하는 데 필요한 정수 형식.

ptrdiff_t는 signed int입니다.

Array Indexing

Array 를 인덱싱할 때 보통 사용하는 int 보다는 ptrdiff_t를 이용하라. 32비트, 64비트의 최대 크기가 다르며 특히 INT_MAX 가 넘을 수가 있기 때문이다. 최대 최소 값은 PTRDIFF_MAX, PTRDIFF_MIN으로 지정 가능하다.

Favorite site