/* decompose.c * * Demonstrates use of passing and using pointers to/in a function. */ #include #include void decompose(double x, long* int_part, double* frac_part); int main() { long i; double d; double pie = 3.14159f; decompose(pie, &i, &d); printf("Decomposed values for %lf: %ld, %lf\n", pie, i, d); return EXIT_SUCCESS; } void decompose(double x, long* int_part, double*frac_part){ *int_part = (long) x; *frac_part = x - *int_part; }