Who can help me? what's wrong with my codes?

this is my puzzle 10.3 answer. the meterstofeetandinches().

#include <stdio.h>
#include <math.h>

void meterstofeetandinches(double meters, unsigned int *ftptr,double inptr){
double rawfeet = meters
3.281;
unsigned int feet ;
double fractionalfoot;
fractionalfoot = modf(rawfeet, &feet);

if(ftptr){
    printf("storing %u to the address %p\n",feet,ftptr);
    *ftptr = feet;
}


double inches = fractionalfoot * 12.0;

if(inptr){
    printf("storing %.2f to the address %p\n", inches,inptr);
    *inptr = inches;
}

}
int main(int argc, const char * argv[]) {
double meters = 3.0;
unsigned int feet;
double inches;
meterstofeetandinches(meters, &feet, &inches);
printf("%.1f meters is equal to %d feet and %.1f inches.",meters,feet,inches);
// insert code here…
printf(“Hello, World!\n”);
return 0;
}

the result is below:
storing 0 to the address 0x7fff5fbff804
storing 10.12 to the address 0x7fff5fbff7f8
3.0 meters is equal to 0 feet and 10.1 inches.Hello, World!
Program ended with exit code: 0

what’s wrong with my codes? who can help me? thanks!!!

I solve it by myself, that’s the answer below:

#include <stdio.h>
#include <math.h>

void meterstofeetandinches(double meters, double *ftptr,double inptr){
double rawfeet = meters
3.281;
double afeet ;
double fractionalfoot;
fractionalfoot = modf(rawfeet, &afeet);
double inches = fractionalfoot * 12.0;
if(ftptr){
printf(“storing %f to the address %p\n”,afeet,ftptr);
*ftptr = afeet;
}

if(inptr){
    printf("storing %.2f to the address %p\n", inches,inptr);
    *inptr = inches;
}

}
int main(int argc, const char * argv[]) {
double meters = 3.0;
double feet;
double inches;
meterstofeetandinches(meters, &feet, &inches);
printf("%.1f meters is equal to %f feet and %.2f inches.",meters,feet,inches);
// insert code here…
printf(“Hello, World!\n”);
return 0;
}

Its not wrong, but that function name is mighty hard to read.

You can camelcase or user underscores to make it more readable

void metersTofeetAndInches (double meters, double *ftptr,double *inptr)

void meters_to_feet_and_inches (double meters, double *ftptr,double *inptr)

that’s a good idea, thank you!:grinning: