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