Why isn't my last printf line printing?

when I run the following code the out put is:

“Storing 9 to the address 0x7fff5fbff714
Storing 10.12 to the address 0x7fff5fbff708
Program ended with exit code: 0”

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; // e.g. 2.4536

// How many complete feet as an unsigned int?
unsigned int feet = (unsigned int)floor(rawFeet);

// Store the number of feet at the supplied address
if (ftPtr){
    printf("Storing %u to the address %p\n", feet, ftPtr);
    *ftPtr = feet;
// Calculate inches
double fractionalFoot = rawFeet - feet;
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 meters is equal to %d feet and %.1f inches.", meters, feet, inches);

return 0;


Dear Objective-C soldier :slight_smile:

If you run your program from the command line, you will see the last line printed, but without a new line at the end.

Alternatively, you can insert a new line character at the end of the format string as in:

printf ("%.1f meters is equal to %d feet and %.1f inches.\n", meters, feet, inches);

Then running the program from Xcode will most likely produce the desired and expected outcome.