help i hv that code but he is giving me an error in "if" help ;D

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MikeBrito
    New Member
    • Jan 2016
    • 1

    help i hv that code but he is giving me an error in "if" help ;D

    #include<stdio. h>
    #include<ctype. h>

    int na
    {
    if(a<b && a<c)
    printf("%d ",a);
    else if(c<b)
    printf("%d ",c);
    else
    printf("%d ",b);
    }




    [Error] expected primary-expression before 'if'

    WHY IT GIVES ME THIS ERROR
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    Is na supposed to be a function?

    If it is, you need an argument list:

    Code:
    int na(...arguments go here...)
    {
    if(a<b && a<c)
    printf("%d ",a);
     else if(c<b)
    printf("%d ",c);
    else
     printf("%d ",b);	
    }
    You also need to define a,b,c, and d.

    The compiler knew it was in trouble at the if. The actual error will be there or at some earlier place in the code. Just put your finger on the if and start looking backwards up the code.

    Comment

    Working...