Thanks to the good prompts in x-code I was able to get this challenge done, but I had to do it pretty differently from how it was done with the floor() function.

My main question is why the final print function works when I put it in the metersToFeetAndInches function and not when I call it in the Main function. I can’t see what I am doing wrong. The print functions in question have BOLD COMMENTS right before them.

Thanks!

[code]//

// main.c

// Meters

//

// Created by James Plauche on 7/27/15.

// Copyright © 2015 Tanner Plauché. All rights reserved.

//

#include <stdio.h>

#include <math.h>

void metersToFeetAndInches (double meters, double *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; //e.g. 2.4536
printf("%f\n", rawFeet);
```

//Assign inches to rawinches by returning what is right of the decimal. store what is to the left at the pointer ftPtr.

double rawInches = modf(rawFeet, ftPtr);

double inches = rawInches * 12;

printf(" There are %.3f inches. \n", inches);

```
// Assign what is at ftPtr to feet.
double feet = *ftPtr;
printf("There are %.1f feet. \n", feet);
//THIS PRINT works when I put it in the function.
printf("%.1f meters is equal to %f feet and %.3f inches.", meters, feet, inches);
}
```

int main(int argc, const char * argv[]) {

```
double meters = 3.0;
double feet;
double inches;
metersToFeetAndInches(meters, &feet, &inches);
//THIS PRINT doesn't work when it is in main.
printf("%.1f meters is equal to %f feet and %.3f inches.", meters, feet, inches);
return 0;
```

}

[/code]

Output is:

```
9.843000
There are 10.116 inches.
There are 9.0 feet.
3.0 meters is equal to 9.000000 feet and 10.116 inches.3.0 meters is equal to 9.000000 feet and 0.000 inches.
```