/*------------------------------------------------------------------*/ /* testswapbad.c */ /* Author: Bob Dondero */ /* The need for call by reference. */ /*------------------------------------------------------------------*/ #include /*------------------------------------------------------------------*/ static void swap(int iFirst, int iSecond) /* Swap the values of iFirst and iSecond. */ { int iTemp; iTemp = iFirst; iFirst = iSecond; iSecond = iTemp; } /*------------------------------------------------------------------*/ int main(void) /* Test the swap function. Return 0. */ { int i1 = 8; int i2 = 12; printf("Before: %d %d\n", i1, i2); swap(i1, i2); printf("After: %d %d\n", i1, i2); return 0; } /* Sample Execution: $ testswapbad Before: 8 12 After: 8 12 */