Pass value : Function Parameters « Function « C / ANSI-C






Pass value



#include <stdio.h>

int change(int number);

void main()
{
   int number = 20;    
   int result = 12;     

   result = change(number);
   printf("\n In main, result = %d \t number = %d", result, number);
}


int change(int number) {
   number = 2 * number;
   printf("\n In function change, number = %d\n", number);
   return number;
}


           
       








Related examples in the same category

1. Calculating an average using variable argument lists Calculating an average using variable argument lists
2.Computes the area of three triangles
3.Demonstrate the use of pointers and parameter passing
4.Pass reference
5.A function to increase your salaryA function to increase your salary
6.Pass array with different dimension into function
7.Pass Array into a function
8.Use function with pointer parameters
9.Define int pointer parameter for a function
10.Pass reference of an int value into function
11.Pass char pointer into function
12.Passing the data type addess into the functionPassing the data type addess into the function
13.Length of the function parameters
14.Return value though parameterReturn value though parameter
15.Pass return value through function parameter
16.Pass array value into function: by array, by empty array and by pointer
17.Define constant function parameter
18.Char pointer as the function parameter
19.Passing parameter by pointer
20.Pass double value into functionPass double value into function