function with multiple arguments

后端 未结 4 1596
隐瞒了意图╮
隐瞒了意图╮ 2021-02-06 05:02

how to pass multiple arguments in a single function in Objective-C? I want to pass 2 integer values and the return value is also integer. I want to use the new Objective-C synta

4条回答
  •  隐瞒了意图╮
    2021-02-06 05:26

    Like this:

    int sum(int a, int b) {
        return a + b;
    }
    

    Called like this:

    int result;
    result = sum(3, 5);
    // result is now 8
    

    More here

提交回复
热议问题