C examples for Function:Function Parameter
Demonstrates passing a variable to a function by value.
#include <stdio.h> void half (int i) // Recieves the value of i { i = i / 2;//from w w w . j a v a 2 s. c o m printf("Your value halved is %d.\n", i); return; // Returns to main } int main() { int i; printf("Please enter an integer... "); scanf(" %d", &i); half(i); printf("In main(), i is still %d.\n", i); return(0); // Ends the program }