In this tutorial you will learn about the Rust Data Types and its application with practical example.
Rust Data Types
Variables are used to represent reserved memory locations that is used to store values, when we create a variable we are a suppose to allocate some memory space for that variable. Rust is a statically typed programming language. This means that variables always have a specific type. Every variable have data type associated to it, data type for a variable defines –
- The amount of memory space allocated for variables.
- A data type specifies the possible values for variables.
- The operations that can be performed on variables.
In Rust, data types are categorized into following two category –
- Primitive Types (Built-In)
- Custom Types
Rust has following primitive data types –
- Numbers
- Boolean
- Characters
- String
- Array
- Slice
- Tuple
Rust has following custom data types –
- Structure
- Enumeration