C Programming
Accept Argument And Also Return
                                   
When we pass any value in calling function and the called function return any value to the calling function then it is called Accept Argument and Also Return. In this case we write the data type of variable in prototype declaration which is going to be pass in calling function and the data type of argument which is going to be return must be written before the name.


Ex.


int sum(int,int);   // prototype declaration

                                 void main()
            {
           int a,b,add;

 printf("Enter two no to add");
scanf("%d%d",&a,&b);

printf("%d%d",a,b);
printf("Now, ready to call");
add=sum(a,b);  // we are calling here sum function
printf("Sum=%d",add);
 getch();
             }
                        int sum(int a, int b) // called function sum or function body

{
int c;
c=a+b;
printf("In called function");
printf("Sum=%d",c);
 return c;
}

Note:
  1.  We can pass different data type variable but in calling function as well as called function the parameter sequence will be same as given in prototype declaration.          
  2. Although there may be more than one return statement in any function but  as soon as the compiler find return statement the control is transferred from called function to calling function.    
                                         C Programming