FreeStyle4 FreeStyle4 - 2 months ago 6x
C Question

Printing number of spaces

Is there a way to specify the number of spaces using a variable?

For example lets say I have a basic print statement:


This will print 5 spaces then the number. Is there a way that would let me declare a variable
var = 5
, and use a variable to determine spacing instead? The reason i'm asking is because I'm trying to control the number of spaces after each iteration of a loop to format data a certain way



 printf("%*d", width, someNumber);

You can find more info by man 3 printf