Skip to content

Instantly share code, notes, and snippets.

@ishankhare07
Forked from anonymous/playground.rs
Created August 28, 2015 07:08
Show Gist options
  • Save ishankhare07/a4a32ea60b41291bfc84 to your computer and use it in GitHub Desktop.
Save ishankhare07/a4a32ea60b41291bfc84 to your computer and use it in GitHub Desktop.
Shared via Rust Playground
//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));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment