0

Here are snippets of my code:

   long long card = get_long_long();

   long long *FindLength = *card;


   while (FindLength != 0)
 {
   FindLength = FindLength / 10;
   counterCardLength++;
 }

And here is the error:

error: invalid operands to binary expression ('long long *' and 'int')
   FindLength = FindLength / 10;

Could somebody help me with this? Thanks in advance.

2

FindLength is a pointer, not a long long integer. This means that the code is trying to divide an address by an integer.

FindLength = FindLength / 10;

In this statement, FindLength contains the address of the long long, not the actual data itself (i.e., the address of card). Why does this need to be a pointer and not just a long long? Also, by using the address, it's also going to divide the original value by 10, not a copy. I assume that this code was intended to create a copy of the number.

If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)

| improve this answer | |
  • Do you know how I could assign a copy of the contents of the card variable to the FindLength variable? – yuniFlaminjo Aug 29 '18 at 6:05
  • long long findLength = card; Maybe you're overthinking it??? ;-) – Cliff B Aug 29 '18 at 8:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .