What does the %# flag in a printf statement in C? : <p>I am doing the chapter 3 of the book learning C the hard way by Zed Shaw. I am exploring the different string formatting options for printf. I encountered the following flag to put after the '%#' symbol:</p>

<p>The value should be converted to an "alternate form". For o conversions, the first character of the output string is made zero (by prefixing a 0 if it was not zero already). For x and X conversions, a nonzero result has the string "0x" (or "0X" for X conversions) prepended to it. For a, A, e, E, f, F, g, and G conversions, the result will always contain a decimal point, even if no digits follow it (normally, a decimal point appears in the results of those conversions only if a digit follows). For g and G conversions, trailing zeros are not removed from the result as they would otherwise be. For other conversions, the result is undefined. </p>

<p>It seems that '%#' flag is for a kind of type conversion for the printf statement. But I am not sure. Does anyone knows what kind of conversion of actual usage this %# flag has in the printf function in C?  I can see any change or conversion for the character "A", which is the one I am using for the flag %# in the last print statement.</p>

<p>This is my code: </p>

<pre><code>#include &lt;math.h&gt;

int main(int argc, char *argv[])
{
    int age = 32; // age and height not initialized
    int height = 182;
    printf("I am %d cm tall.\n", age); 
    printf("I am %d years old.\n", height); 
    printf("I wanna go to \"Panama\"\n"); // scaping double quotes 
    printf("I am %2$d tall and %1$d years old\n", age, height); // how to use positional arguments in printf statement
    // how to use positional arguments in printf statement  
    printf("I am using the number pi: %'.2f\n", 3.1415939);

    // Testing the %# formatting 
    printf("Testing for A: %# \n", 'A');
    return 0;
}
</code></pre>

<p>The output I receive: </p>

<pre><code>I am 32 cm tall.
I am 182 years old.
I wanna go to "Panama"
I am 182 tall and 32 years old
I am using the number pi: 3.14
Testing for A: %# 
</code></pre>
