0

I am trying to understand a program in c and there is a format which I do not understand. Below is what I do not understand

%06i

I do not understand why there is 06, why is it needed. Below is an example of the snippet of the line of code that I am looking at.

printf("\n\t%06i\t...", id, wage, hours, gross);

1 Answer 1

1

It's a formatting code. It means to pad the number with leading zeros so that it is at least 6 digits. If the actual integer is 6 or more digits, it won't get any leading zeros. You can google printf format codes to learn more.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .