By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,052 Members | 1,303 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,052 IT Pros & Developers. It's quick & easy.

error C2297: '*': illegal, right operand has type 'real [3]'

P: 2
hi everyone
I`m encountering with this error: error C2297: '*': illegal, right operand has type 'real [3]'

when I compile my code:

Expand|Select|Wrap|Line Numbers
  1.  #include "udf.h"
  2.  
  3.  DEFINE_PROFILE(inlet_x_velocity, thread, position)
  4.  {
  5.     real x[ND_ND]; /* this will hold the position vector */
  6.     real y, h;
  7.     face_t f;
  8.     h = 0.252; /* inlet height in m */
  9.     begin_f_loop(f,thread)
  10.       {
  11.         F_CENTROID(x, f, thread);
  12.         y = 19502.0 * pow(x,3.0) - 27.511 * pow(x,2.0) - 28.601 * x + 0.5247; /* non-dimensional y coordinate */
  13.         F_PROFILE(f, thread, position) = 0.1*(1.0-y*y);
  14.       }
  15.     end_f_loop(f, thread)
  16.  }
2 Weeks Ago #1
Share this Question
Share on Google+
3 Replies


Expert 100+
P: 2,400
Line 12 contains three references to x. Each of these references uses x as it were type real. However x is actually an array of real.
2 Weeks Ago #2

P: 2
thanks for your respond
so, what should I do? I'm not good at coding, what I did was just copying this code from the Ansys manuals and changing the line12 equation.
2 Weeks Ago #3

dev7060
100+
P: 117
Just provide a proper data-type value as the 1st argument of pow(). More info here: http://www.cplusplus.com/reference/cmath/pow/

'x' is an array of real here -> not something the function pow() expects.
5 Days Ago #4

Post your reply

Sign in to post your reply or Sign up for a free account.