Reputation: 33
short int cipher[50],len;
while(cipher != 0)
{
cipher=cipher/10;
++len;
}
Need to count number of digits provided by user.
error: invalid operands to binary / (have ‘short int *’ and ‘int’)
cipher=cipher/10;
Upvotes: 3
Views: 129
Reputation: 19375
As gsamaras noted, you defined cipher
as an array of 50 short int
s. Presumably you want only one number, so you'd define it e. g. as long long cipher;
(C is not COBOL or something where one has to specify the number of digits). And don't forget to initialize len
.
Upvotes: 2