Chapter 10 (in book v2) PBR challenge

Could someone tell me if there is anything wrong with my code? I’m getting correct results, but I’m not feeling totally confident about for some reason:

[code]#include <stdio.h>
#include <math.h>

void metersToFeetAndInches(double meters, unsigned int *ftPtr, double *inPtr)
{
//This function assumes meters is non-negative.

//Convert the number of meters into a floating-point number of feet
double rawFeet = meters * 3.281; // example 2.4536
double rawFeetIntegerPart;
double rawFeetDecimalPart;

//Separate integer part from decimal part?
//unsigned int feet = (unsigned int)floor(rawFeet);
rawFeetDecimalPart = modf (rawFeet, &rawFeetIntegerPart);

//Store the number of feet at the supplied address
if (ftPtr) {
    printf("Storing %.0f to the address %p\n", rawFeetIntegerPart, ftPtr);
    *ftPtr = rawFeetIntegerPart;
}

//Calculate inches
double fractionalFoot = rawFeet - rawFeetIntegerPart;
double inches = fractionalFoot * 12.0;

//Store the number of inches at the supplied address
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 meter(s) is equal to %d feet and %.1f inches.", meters, feet, inches);


return 0;

}[/code]

Thank you!!!

Looks great to me. Love your use of comments and useful/descriptive variable names.