Returning multiple values from a C++ function

后端 未结 21 2525
别跟我提以往
别跟我提以往 2020-11-22 01:04

Is there a preferred way to return multiple values from a C++ function? For example, imagine a function that divides two integers and returns both the quotient and the rema

21条回答
  •  囚心锁ツ
    2020-11-22 01:55

    rather than returning multiple values,just return one of them and make a reference of others in the required function for eg:

    int divide(int a,int b,int quo,int &rem)
    

提交回复
热议问题