printed out an unsorted array

This commit is contained in:
jellyfishsh 2025-04-12 13:23:58 -07:00
parent 06461db6de
commit 837804b937

View File

@ -1,13 +1,27 @@
fn main() { fn main() {
println!("Hello, world!"); println!("Hello, world!");
// // Array to use
} let test_array : [i32; 6] = [5, 35, 4, 8, 1, 2];
//Takes in an array, and returns a sorted array
fn selection_sort() {
print!("Here are the values of the array, unsorted: ");
for n in test_array {
print!("{}, ", n);
}
} }
fn random_array(size : u32) -> //selection_sort : implementation of selection sort
//Takes in an array, and returns a sorted array usin
//the selection sort algorithm
// Im going to assume that all functions take in immutable params
// Which is nice... but are they references?
//No. Rust is strictly pass by value on default.
// => we must pass a reference to the array
fn selection_sort(unsorted_array : &mut [i32]) {
}