/** * Program to demonstrate/test function with pointer parameters. */ #include #include /* compute x / y and x % y */ void divide(int a, int b, int * quotient, int * remainder) { *quotient = a/b; *remainder = a%b; } /* main */ int main(void) { int x; int y; int q = 0; int r = 0; printf("enter two integers\n"); if (scanf("%d %d", &x, &y) == 2) { divide(x, y, &q, &r); printf("dividing %d by %d gives quotient %d and remainder %d\n", x, y, q, r); return EXIT_SUCCESS; } else { printf("input error\n"); return EXIT_FAILURE; } }