Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Expected identifier or '('

Tags:

c

Am getting this compiling error, but can't figure out why. Error message is commented.

float remainingAngle(float angleA, float angleB);
{                                           // Expected identifier or '('
    return 180 - (angleA + angleB);
}


int main (int argc, const char * argv[])
{
        float angleA = 30.0;
        float angleB = 60.0;
        float angleC = remainingAngle(angleA, angleB);
        printf("The third angle is %.2f", angleC);
        return 0;
}
like image 712
pdenlinger Avatar asked Dec 03 '22 00:12

pdenlinger


2 Answers

You have a semi-colon at the end of the first line.

like image 176
Oliver Charlesworth Avatar answered Dec 04 '22 14:12

Oliver Charlesworth


Remove the semi-colon between the function declaration and the opening brace

like image 34
antlersoft Avatar answered Dec 04 '22 15:12

antlersoft