Pass parameter to Functions by value - C Function

C examples for Function:Function Parameter

Description

Pass parameter to Functions by value

Demo Code

#include <stdio.h> 

int addTwoNumbers(int, int); 

int main()//from w  w  w . j  a va2 s.  c  o m
{ 
   int x = 0; 
   int y = 0; 
   printf("\nEnter first number: "); 
   scanf("%d", &x); 
   printf("\nEnter second number: "); 
   scanf("%d", &y);  
   printf("\nResult is %d\n", addTwoNumbers(x, y)); 
}  //end main 

int addTwoNumbers(int x, int y) 
{ 
   return x + y; 
}  //end addTwoNumbers

Related Tutorials