首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >编译时出错:"invalid operands to binary / (have‘short int *’and‘int’)“

编译时出错:"invalid operands to binary / (have‘short int *’and‘int’)“
EN

Stack Overflow用户
提问于 2019-01-23 17:39:59
回答 1查看 117关注 0票数 3
代码语言:javascript
复制
short int cipher[50],len;
while(cipher != 0)
{  
    cipher=cipher/10;
    ++len;
}

需要统计用户提供的位数。

代码语言:javascript
复制
 error: invalid operands to binary / (have ‘short int *’ and ‘int’)
           cipher=cipher/10;
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-01-23 17:50:34

正如gsamaras所提到的,你将cipher定义为一个由50个short int组成的数组,假设你只想要一个数字,所以你可以将它定义为例如long long cipher; (C不是COBOL语言或者其他必须指定位数的语言)。别忘了初始化len

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54324169

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档