Test of passing arguments by value by changing its value inside function - C Function

C examples for Function:Function Parameter

Description

Test of passing arguments by value by changing its value inside function

Demo Code

#include <stdio.h>  

void demoPassByValue(int); 

int main()/*from   w ww. j a va2 s . c  o m*/
{ 
   int x = 0; 
   printf("\nEnter a number: "); 
   scanf("%d", &x); 
   demoPassByValue(x); 
   printf("\nThe original value of x did not change: %d\n", x); 
}
void demoPassByValue(int x) 
{ 
   x += 5; 
   printf("\nThe value of x is: %d\n", x); 
}

Related Tutorials