Starting to work with pointers

This commit is contained in:
pro100ton 2024-12-13 23:30:22 +03:00
parent 7c8e99f5aa
commit 2980a58784

View file

@ -0,0 +1,16 @@
#include <stdio.h>
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;
}