编译时出错:“二进制操作数无效/(有'short int *'和'int')”

问题描述 投票:3回答:1
short int cipher[50],len;
while(cipher != 0)
{  
    cipher=cipher/10;
    ++len;
}

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

 error: invalid operands to binary / (have ‘short int *’ and ‘int’)
           cipher=cipher/10;
c syntax-error
1个回答
2
投票

正如gsamaras所说,你将cipher定义为50个short ints的数组。大概你只需要一个数字,所以你要定义它。 G。作为long long cipher;(C不是COBOL或必须指定位数的东西)。并且不要忘记初始化len

© www.soinside.com 2019 - 2024. All rights reserved.