0

Why do I have a syntax error in this line ?
I think that everything is correct

fMaxElem = fabs(double pfMatr[k*nDim + k] , int k); // error C2059: syntax error : ')'
    m = k;
    for(i=k+1; i<nDim; i++)
    {
      if(fMaxElem < fabs( double pfMatr[i*nDim + k], int k) )//error C2143: syntax error : missing ';' before '{'
      {
        fMaxElem = pfMatr[i*nDim + k];
        m = i;
      }
    }

Edited by Nick Evan: Fixed formatting

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by VernonDozier
0

Why do I have a syntax error in this line ?
I think that everything is correct
fMaxElem = fabs(double pfMatr[k*nDim + k] , int k); // error C2059: syntax error : ')'
m = k;
for(i=k+1; i<nDim; i++)
{
if(fMaxElem < fabs( double pfMatr[i*nDim + k], int k) )//error C2143: syntax error : missing ';' before '{'
{
fMaxElem = pfMatr[i*nDim + k];
m = i;
}
}

Leave off the "int" and "double" in the function call:

fMaxElem = fabs(double pfMatr[k*nDim + k] , int k); // error C2059: syntax error : ')'

Delete the words in red. "double" and "int" belong in function declarations, not function calls.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.