primitive-type

Rust i32: 32-bit signed integer

`i32` stores signed whole numbers in 32 bits. Its range is -2,147,483,648 through 2,147,483,647. A signed count, such as a balance measured in cents. Expected output: -250 Why: The chosen value is representable by i32. Common mistake: Do not assume integer arithmetic never overflows.

Formal Syntax & Structure

rust syntaxrust
let name: i32 = integer_literal;

Working Example

Example Snippetrust
fn main() {    let balance: i32 = -250;    println!("{balance}");}
Rust Reference