diff --git a/c_modern_approach/Pointers/theory.c b/c_modern_approach/Pointers/theory.c new file mode 100644 index 0000000..a730bb0 --- /dev/null +++ b/c_modern_approach/Pointers/theory.c @@ -0,0 +1,16 @@ +#include +void decompose(double, long *, double *); + +int main() { + long mp; + double rm; + double x = 3.141234; + printf("%ld, %f\n", mp, rm); + decompose(x, &mp, &rm); + printf("%ld, %f\n", mp, rm); +} + +void decompose(double x, long *int_part, double *frac_part) { + *int_part = (long)x; + *frac_part = x - *int_part; +}