Invalid conversion from 'int' to 'double*'

后端 未结 4 1566
暖寄归人
暖寄归人 2021-01-25 07:52

I have this line of code:

int g = modf(ans*power, 1)*10;

And it is giving me the error:

Invalid conversion from \'int\'

4条回答
  •  被撕碎了的回忆
    2021-01-25 08:12

    I don't see where I am using a pointer : you're not, and that is the problem. Look at the signature of modf:

    double modf( double, double* );
    

    It requires a double* as second argument; you're passing it an int.

提交回复
热议问题