1

Here is a snippet of my code:

long long card = get_long_long();

long long *FindLength = *card;

long long *FindFirstTwoDigits = *card;

And here are the errors:

credit1.c:8:29: error: indirection requires pointer operand ('long long' 
invalid)
long long *FindLength = *card;
                        ^~~~~
credit1.c:10:37: error: indirection requires pointer operand ('long long' 
invalid)
long long *FindFirstTwoDigits = *card;

Could somebody help me with this? Thanks in advance.

1

What is supposed to be * card? We can not apply own operators of a pointer to a variable of integer type in this case. It seems that the compiler is interpreting this as an indirect operation of a pointer. Well we have the statement:

long long * FindLength

this declares a pointer to an integer of type long long, a pointer can only contain a memory address, if what you want to do is assign the memory address of the card variable to FindLength you should do the following

long long * FindLength = &card;

I hope this answers your question, keep in mind that it is not very clear and I do not know exactly your intentions.

1
  • Thank you for your explanation. I am sorry I did not make it more clear. I was actually trying to assign a copy of the contents of variable card to variables FindLength and FindFirstTwoDigits. Do you know how I might go about doing this? – yuniFlaminjo Aug 29 '18 at 6:01

You must log in to answer this question.

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