eroor is :
1.call to undefined fn calsum() in fn main
2.fn should return a value
#include%26lt;stdio.h%26gt;
main()
{
int a,b,c,sum;
printf("Enter any three nos");
scanf("%d%d%d",%26amp;a,%26amp;b,%26amp;c);
sum=calsum(a,b,c);
printf("\n sum=%d",sum);
}
calsum(x,y,z)
int x,y,z;
{
int d;
d=x+y+z;
return(d);
}
I am getting 1 error in below function program.plz..solve this?
calsum needs a return type (probably int)
Reply:hi,the coding is correrct,but some mistakes,there are first thing have notice the function type,function returning value so,u will write datatype for its return type...ie.
#include%26lt;stdio.h%26gt;
void main()
{
int a,b,c,sum;
printf("Enter any three nos");
scanf("%d%d%d",%26amp;a,%26amp;b,%26amp;c);
sum=calsum(a,b,c);
printf("\n sum=%d",sum);
}
int calsum(x,y,z)
int x,y,z;
{
int d;
d=x+y+z;
return(d);
}
becoz the return type is int..
Reply:Your program should state the return type for the function, I have corrected it for you. Because function calsum return a value of type int therefore its method return type should also be put int.
#include%26lt;stdio.h%26gt;
void main()
{
int a,b,c,sum;
printf("Enter any three nos");
scanf("%d%d%d",%26amp;a,%26amp;b,%26amp;c);
sum=calsum(a,b,c);
printf("\n sum=%d",sum);
}
int calsum(x,y,z)
int x,y,z;
{
int d;
d=x+y+z;
return(d);
}
parts of a flower
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment