-
-
Save RandyMcMillan/388aa23b5b543cf7cbac40ef684ab2db to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn random() { | |
let num1 = vec![2, 3]; | |
let num2 = vec![2, 3]; | |
let address1 = &num1 as *const Vec<i32>; | |
let address2 = &num2 as *const Vec<i32>; | |
let number1 = address1 as i32; | |
let number2 = address2 as i32; | |
let modulus: i32 = 13; | |
// println!("{}", number1); | |
// println!("{}", number2); | |
println!("{} % {} = {}", number1, modulus, number1 % modulus); | |
println!("{} % {} = {}", number2, modulus, number2 % modulus); | |
let _num1:i32 = number1 % modulus; | |
let _num2:i32 = number2 % modulus; | |
println!("{} ^ {} = {}", _num2,_num1,number2 % modulus ^ number1 % modulus); | |
} | |
fn main() { | |
random(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment