ADVERTISEMENT
ADVERTISEMENT

Rust program to demonstrate the isize and usize datatypes

Here, we are going to demonstrate the isize and usize datatypes in Rust programming language?
Submitted by Nidhi, on September 21, 2021

Problem Solution:

Here, we will create variables using isize and usize data types. isize is a pointer-sized signed integer type and usize is a pointer-sized unsigned integer type.

Program/Source Code:

The source code to demonstrate isize and usize datatype is given below. The given program is compiled and executed successfully.

// Rust program to demonstrate 
// isize and usize datatypes.

fn main() {
	// The pointer-sized signed integer type
	let mut var1:isize=-10;  
	// The pointer-sized unsigned integer type
	let mut var2:usize=30;  

	println!("Var1: {}",var1);
	println!("Var2: {}",var2);
}

Output:

Var1: -10
Var2: 30

Explanation:

Here, we created 2 variables var1, var2 of isize and usize datatype respectively. Then we printed the value of variables using println!() macro.

Rust Basic Programs »



ADVERTISEMENT



ADVERTISEMENT



Comments and Discussions


ADVERTISEMENT

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.