diff --git a/src/main.rs b/src/main.rs index 5cf672f..00cf2cb 100644 --- a/src/main.rs +++ b/src/main.rs @@ -26,6 +26,7 @@ fn tri(n: usize, arr: &mut [u32]) -> Result<(), &str> { while i < n { tmp = arr[i]; j = i; + while j < n { if tmp > arr[j] { arr[i] = arr[j]; @@ -39,10 +40,12 @@ fn tri(n: usize, arr: &mut [u32]) -> Result<(), &str> { i += 1; } } + Ok(()) } fn main() { + // TODO faire des meilleurs test let mut test : [u32; 5] = [5, 2, 1, 4, 5]; match tri(5, &mut test) { Ok(_) => { println!("Tableau = {:?}", test) }