8 years, 8 months ago.

What is this error?

What is this error?

Question relating to:

"848: expression must have arithmetic or enum type" are you able to share an example of how to produce this error?

posted by Stephen Paulger 03 Aug 2015

1 Answer

8 years, 8 months ago.

It's probably something like trying to multiply a number by a pointer. e.g.

    int y = 5;
    int *p = &y;
    int x = 4*p;

results in an error 848 on line 3.

Changing it to use the value p points to:

    int y = 5;
    int *p = &y;
    int x = 4*(*p);

results in it compiling OK and setting x to 20.

If that doesn't seem to fix the problem then please supply the line that causes the error and the declarations of any variables used in that line otherwise it's hard to help you fix it..

Well done, I was trying to write some code to re-create this error but was only able to get 847s.

posted by Stephen Paulger 04 Aug 2015

You get a 847 by using a float in a switch statement, that was the first thing I tried for this error. What else generates them?

posted by Andy A 04 Aug 2015