Facing error saying something about an 'unqualified Id'

#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
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
thanks mate JLBorges.you made my day.
Topic archived. No new replies allowed.