/*! \file pass-by-value.c \brief Small example that illustrates the fact that C passes its parameters by value instead of by reference. Although x is modified in the function foo, the main function does not see that modification after the call to foo(). \author Michelle Strout \date October 2008 */ #include void foo(int x) { printf("foo: x = %d\n", x); x = 45; printf("foo: x = %d\n", x); } int main() { int x = 21; printf("x = %d\n", x); foo(x); printf("x = %d\n", x); return 0; }