Hello everyone,
I have a question on adding two arrays together, illustrating using the following code.
real[int] vec1(2), vec2(2), vec3(2);
vec1 = 1.;
vec2 = 2.;
vec3 = 2*(vec1+vec2);
Then the code cannot run, with problem saying “error operator * , <7Add_KN_IdE>”. However, once I change the last sentence to the following
vec3 = 2 * vec1 + 2 * vec2;
Then the code is good to run. I’m really confused about how this problem occurs. Thanks if anyone can help.