Facing error saying something about an 'unqualified Id'

Oct 4, 2018 at 1:49pm
#include<stdio.h>
int add(int a,int b);
int main(void)
{
int a,b,c;
scanf("%d%d",&a,&b);
c=add(a,b);
printf("sum is %d",c);
return 0;
}
int sum(int a,int b);
{
int s;
s=a+b;
return s;
}

After i compile this program,it is showing me an error in the 12th line saying"expected unqualified if before '{'."
I've seen similar questions like this I'm not satisfied with the answers given by them.
Please someone help me.
Thanks in advance...
Last edited on Oct 5, 2018 at 12:54pm
Oct 4, 2018 at 1:59pm
Remove the semicolon at the end of line 11, and the function should be add, not sum:
1
2
3
4
5
6
7
// int sum(int a,int b);
int add(int a,int b)
{
    int s;
    s=a+b;
    return s;
}
Last edited on Oct 4, 2018 at 2:01pm
Oct 5, 2018 at 1:07pm
thanks mate JLBorges.you made my day.
Topic archived. No new replies allowed.