Thread: C Programming
View Single Post
Old 01-12-2005, 10:39 AM   #7 (permalink)
holy_devil_
 
Newb Techie

Join Date: Jan 2005

Posts: 9

holy_devil_

Default

main()
{
int a,b,c;
a=5;
b=8;
c=add(a,b)
printf(c);
}
int add(int y, int x)
{
int z=y+x;
return z;
}


here you have to declare add(int,int) first becoz you are defining it after the call has been made. otherwise simply put the definition before main likr:......

int add(int y, int x)
{
int z=y+x;
return z;
}
main()
{
int a,b,c;
a=5;
b=8;
c=add(a,b);
//printf("%d",c);
}
holy_devil_ is offline