I have a small doubt about formal specifiers.
I have seen in many programs of printf statements,writing "%2d".What is the use of writing
an integer before d or any formal specifiers.
Thanks in advance
Read about the format specifiers! The 2 in %2d says to display the integer in 2 or more characters. For example if x = 1, then it will show a space before the 1, like in " 1". But if x = 123 then it will just show all the … Read More
[B]>What is the use of writing an integer before d or any formal specifiers.[/B] It gives you more control over the output than the defaults. You can override field width, padding, justification, precision, sign display, and whatnot. In this case, you're changing the field width. For example, if you're writing … Read More
Edited by Ancient Dragon: n/a