Add Two No.Using Function With Argument And Return Value

//Add two no.using Function with argument and return value


int add(int,int);         //function declaration


   int a,b,c;

   printf("\n"); //newline

   printf("Enter value of a:");       //user give input


   printf("Enter value of b:");      //user give input


   c=add(a,b);        //function call (main function passing value of a and b to function add). Here  a and b is actual argument/parameter

   printf("Addition of a and b is:%d",c);



int add(int x,int y)      //function definition.Here x and y formal argument/parameter bcuz value of a and b copy in x and y respectively
   int z;
   z=x+y;     //add both x and y

 return z;        //used bcuz return type is int so value passed to function main where function add() called.This time main also passing value to function add(a,b)


Related Posts