/* * Extremely simple example of parameter passing, illustrating use * of pointer arguments to achieve something like pass by reference. */ #include /* pass x by value */ void foo(int x) { x = 20; } /* pass *p "by reference" */ void bar(int* p) { *p = 20; } /* main program */ int main(void) { int x = 10; foo(x); printf("%d\n", x); bar(&x); printf("%d\n", x); return 0; }