Guest User

Untitled

a guest
Apr 20th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. fn smallest(v: &[i32]) -> &i32 {
  2. let mut s = &v[0];
  3. for r in &v[1..] {
  4. if *r < *s {
  5. s = r;
  6. }
  7. }
  8. s
  9. }
  10.  
  11. fn main() {
  12. let s;
  13. {
  14. let v = [2,1,3];
  15. s = smallest(&v);
  16. }
  17. println!("{}", *s)
  18. }
Add Comment
Please, Sign In to add comment