[C++] C++ Data Type

JAsmine_log·2024년 6월 2일
0

C++

Data Type

01. Primitive Data Types:

Built-in(내장) 또는 Pre-defined(미리 정의된) 데이터 타입으로, 바로 선언하여 사용할 수 있다.

  • Integer
  • Character
  • Boolean
  • Floating Point
  • Double Floating Point
  • Valueless or Void
  • Wide Character

02 Derived Data Types:

Primitive or built-in datatypes에서 파생하여 앞의 유형을 참조하는 데이터이다.

  • Function
  • Array
  • Pointer
  • Reference

03 Abstract or User-Defined Data Types:

Abstract(추상) or User-Defined(사용자 정의) data types으로, 사용자가 직접 정의하여 사용한다.

  • Class
  • Structure
  • Union
  • Enumeration
  • Typedef defined Datatype

Datatype Modifiers

Built-in 데이터 타입의 길이를 수정하기 위해 활용한다.

  • Signed - Integer, Char, Long-Prefix
  • Unsigned - Integer, Char, Short-Prefix
  • Long - Integer, Double
  • Short - Integer

Data Type Size

Data Modifer-Data Type을 정의하였을 때의 사이즈와 그 범위는 아래와 같다.

Data Type, Size (in bytes), Range

  • short int 2 bytes, -32,768 ~ 32,767

  • unsigned short int 2bytes, 0 ~ 65,535

  • unsigned int 4 bytes, 0 to 4,294,967,295

  • int 4 bytes, -2,147,483,648 to 2,147,483,647

  • long int 4 bytes, -2,147,483,648 to 2,147,483,647

  • unsigned long int 4 bytes, 0 to 4,294,967,295

  • long long int 8 bytes, -(2^63) to (2^63)-1

  • unsigned long long int 8 bytes, 0 to 18,446,744,073,709,551,615

  • signed char 1 bytes, -128 to 127

  • unsigned char 1 bytes, 0 to 255

  • float 4 bytes, 3.4×1038-3.4×10^{38} to 3.4×10383.4×10^{38}

  • double 8 bytes, 1.7×10308-1.7×10^{308} to 1.7×103081.7×10^{308}

  • long double 12 bytes, 1.1×1049321.1×10^{4932} to 1.1×1049321.1×10^{4932}

  • wchar_t 2 or 4 bytes, 1 wide character


Reference
[1] https://www.geeksforgeeks.org/cpp-data-types/

profile
Everyday Research & Development

0개의 댓글

관련 채용 정보