funptr1.carbon 306 B

123456789101112
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. fn add1(x: i32) -> i32 {
  5. return x + 1;
  6. }
  7. fn main() -> i32 {
  8. var f: fnty(i32)->i32 = add1;
  9. return f(-1);
  10. }