如何解决,错误如下:

img


如何解决,错误如下:invalid operands of types'int*' and 'long long unsigned int'to binary 'operator*'

n * sizeof(int)
->
(*n) * sizeof(int)
或者把 n定义成 int类型

  • 这篇博客: 【c】 invalid operands of types ‘int‘ and ‘double‘ to binary ‘operator%‘中的 % 符号报错问题 部分也许能够解决你的问题, 你可以仔细阅读以下内容或跳转源博客中阅读:
  • *和/的操作数应为算术或枚举类型;%的操作数应为整数或枚举类型。
    在这里插入图片描述
    解决:也就是% 只能用于整型或枚举类型,要么把double改为int类型;要么使用fmod函数;

    double fmod(double x, double y) 返回 x 除以 y 的余数。	math.h库
    

    查看更详细解释

供参考:

img