Skip to content

Instantly share code, notes, and snippets.

@ishankhare07
Forked from anonymous/playground.rs
Created August 28, 2015 07:08
Show Gist options
  • Select an option

  • Save ishankhare07/a4a32ea60b41291bfc84 to your computer and use it in GitHub Desktop.

Select an option

Save ishankhare07/a4a32ea60b41291bfc84 to your computer and use it in GitHub Desktop.

Revisions

  1. @invalid-email-address Anonymous created this gist Aug 28, 2015.
    11 changes: 11 additions & 0 deletions playground.rs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    //function pointer

    fn foo(x: i32) -> i32 {
    return x+1;
    }

    fn main() {
    let mut x: fn(i32) -> i32 = foo;
    // or x = foo;
    println!("{}", x(10));
    }