值类型与引用类型

计算机编程中的数据类型可分为两族：值类型（value type）与引用类型（reference type）。值类型的值就是实际值。引用类型的值是到其他值的引用。

 各种编程语言的分类 
 语言 值类型  引用类型 C++ 布尔值、字符、整数、浮点数、类（包括字符串、列表、映射、集合、堆栈、队列）、枚举  参考，指针 Java  布尔值、字符、整数、浮点数  数组、类（包括不可变字符串、列表、字典、集合、堆栈、队列、枚举）、接口、空指针 C#  structures (including booleans, characters, integer numbers, floating-point numbers, fixed-point numbers, lists, dictionaries, sets, stacks, queues, optionals), enumerations  classes (including immutable strings, arrays, tuples, lists, dictionaries, sets, stacks, queues), interfaces, pointers Swift  structures (including booleans, characters, integer numbers, floating-point numbers, fixed-point numbers, mutable strings, tuples, mutable arrays, mutable dictionaries, mutable sets), enumerations (including optionals), and user-defined structures and enumerations composing other value types.  functions, closures, classes Python    classes (including immutable booleans, immutable integer numbers, immutable floating-point numbers, immutable complex numbers, immutable strings, byte strings, immutable byte strings, immutable tuples, immutable ranges, immutable memory views, lists, dictionaries, sets, immutable sets, null pointer) JavaScript  immutable booleans, immutable floating-point numbers, immutable integer numbers (bigint), immutable strings, immutable symbols, undefined, null  objects (including functions, arrays, typed arrays, sets, maps, weak sets and weak maps) OCaml  immutable characters, immutable integer numbers, immutable floating-point numbers, immutable tuples, immutable enumerations (including immutable units, immutable booleans, immutable lists, immutable optionals), immutable exceptions, immutable formatting strings  arrays, immutable strings, byte strings, dictionaries (including pointers)

 装箱和拆箱(boxing and unboxing) 
区分值类型与引用类型的语言，典型包括了装箱机制。即把一些甚至全部值类型包为引用类型。这使得值类型可用在需要引用类型的场合。逆过程称为拆箱。
 参见 
 基本类型
 複合型別

 参考文献

Category:数据类型