Home »
Rust »
Rust Programs
Rust program to create an alias of built-in data type
Here, we are going to learn how to create an alias of built-in data type in Rust programming language?
Submitted by Nidhi, on September 21, 2021
Problem Solution:
Here, we will create an alias or alternative name of the i32 datatype. Then we will create a variable using an alias name.
Program/Source Code:
The source code to create an alias of built-in data type is given below. The given program is compiled and executed successfully.
// Rust program to create an alias
// of built-in data type
fn main() {
type int=i32;
let mut num:int=1024;
println!("Number: {}",num);
}
Output:
Number: 1024
Explanation:
Here, we created the alias of the i32 data type using the type keyword. Then we created a variable using created alias name and printed the value of the variable.
Rust Basic Programs »