Function calls by passing variables as parameters - C Function

C examples for Function:Function Definition

Description

Function calls by passing variables as parameters

Demo Code

#include <stdio.h> 
int addTwoNumbers(int, int);  //function prototype 

int main() { /*  www.ja va  2  s.com*/
   int num1, num2; 
   printf("\nEnter the first number: "); 
   scanf("%d", &num1); 
   printf("\nEnter the second number: "); 
   scanf("%d", &num2); 
   printf("\nThe result is %d\n", addTwoNumbers(num1, num2)); 
} 
//function definition 
int addTwoNumbers(int operand1, int operand2) { 
   return operand1 + operand2; 
}

Result


Related Tutorials