Solution for Exercise 6-3

ex0603

#include <stdio.h>

int main()
{
    char c;
    int i;
    float f;
    double d;

    c = 'a';
    i = 1;
    f = 19.0;
    d = 20000.009;

    printf("%c\n%d\n%f\n%f\n",c,i,f,d);
    return(0);
}

Notes

* The printf() statement looks really complex. It's not. The combination of conversion characters and the \n escape sequence makes it appear far more complex than it really is.

* I would typically not use such a complex printf() statement in my code. While it works, it's just not readable enough to know what's going on. Generally speaking, in such a situation, I would break the single statement up into multiple statements, as was done in Exercise 6-2.