-
compiling error
hi..
it is a problem when i compile my program and it says:
375:9: error: expected identifier or ‘(’ before numeric constant
397:9: error: lvalue required as left operand of assignment
this is the code:
Code:
int buihsort(float volt[fat], float resist[fat], float inductance[fat], float imped[fat], float ampere[fat], float power[fat])
{
int i, j;
float im=0;
float v=0;
float asist=0;
float in=0; //this is the 375 line
float am=0;
float po=0;
for (i = (fat - 1); i > 0; i--)
{
for (j = 1; j <= i; j++)
{
if (imped[j-1] > imped[j])
{
im = imped[j-1];
imped[j-1] = imped[j];
imped[j] = im;
v = volt[j-1];
volt[j-1] = volt[j];
volt[j] = v;
asist = resist[j-1];
resist[j-1] = resist[j];
resist[j] = asist;
in = inductance[j-1]; // this is the 397 line
inductance[j-1] = inductance[j];
inductance[j] = in;
am = ampere[j-1];
ampere[j-1] = ampere[j];
ampere[j] = am;
po = power[j-1];
power[j-1] = power[j];
power[j] = po;
}
else{;}
}
}
}
Please help me anyone....
-
Is in defined anywhere else in your program as a global of some sort?
-
That code will not give those errors you report.
If "fat" is a const integral value, then there are no problems with that code. If "fat" is not defined as an integral value, the code will not compile, but will give errors on the argument list for the function. Those errors will differ from what you have described.
The possible causes of your error message are endless. Three obvious possibilities are
1) They correspond to another source file, and you have misinterpreted them.
2) Code you have not shown in the source file from which you have extracted these lines is somehow responsible for the error.
3) When compiling, you have defined some macros (possibly in an included header) that conflict with your code. Such as a macro named "in".
Whatever the cause is, the information you have provided here is insufficient for someone else to identify the problem for you.