cancel
Showing results for 
Search instead for 
Did you mean: 

error: invalid operands to binary * (have 'u8 *' and 'double')

sumalatha
Associate II
Posted on November 15, 2010 at 06:58

error: invalid operands to binary * (have 'u8 *' and 'double')

2 REPLIES 2
trevor23
Associate III
Posted on May 17, 2011 at 14:14

Obviously you need to show how the variables are declared (what type are they?) for anyone to be able to help. You also need to indicate what build/compiler tools you are using. Try not to post a single line of code as an example -- post at least the entire function that the  code is in.

Andrew Neil
Evangelist
Posted on May 17, 2011 at 14:14

Yes, in general it's not going to be possible to answer a question from just a single line of code given entilerly out of context!

You need to give sufficient context for the question to be meaninfgul - which means that it must show the declarations/definitions of all symbols involved.

And it is usually necessary to know what toolset and version is being used.

But, in this case, I think the answer should be obvious just from reading the error message:

error: invalid operands to binary * (have 'u8 *' and 'double') 

 

 

The ''binary *'' operator in 'C' is the multiplication operator - isn't it?

So the message is saying that you are trying to multiply something of type 'u8*' by something of type 'double'

 

 

Now, the type 'u8*' is a pointer, isn't it?

And the type 'double' is a floating point.

What kind of result were you expecting from multiplying a pointer by a floating point number...??!