How to use the return value of a function with parameters inside another function

后端 未结 6 1273
孤城傲影
孤城傲影 2021-01-29 15:59

All these functions are outside the int main():

int func1(int x) {

    int v1 = 6 * x;
    return v1; // the input argument will be 2, so v1 = 12
}

int func2()         


        
6条回答
  •  臣服心动
    2021-01-29 16:52

    Should be:

    int func2(){
        int v2 = func1(2) / 4; // It's suppose to be 12 / 4
        return v2;
    }
    

    Whenever you call a function, you have to pass the parameters it requires.

    You get "too few arguments" because you're not passing the right amount of arguments!

提交回复
热议问题