Currently, I am attempting to repeat a single character in the least characters possible. as an example, I am actually using something similar to this to repeat a series of spaces:
printf("%*s",i,"");
And I was wondering if there was a similar, or even shorter/different way in C to repeat a string and print it out, as with the spaces.
I would like something similar to this if possible:
printf("%*s",i,"_");
However, as far as I know, that's not possible, however ideal it would be for me.
To clarify, in these examples the argument i represents the number of times I would like the character to repeat, i.e, the second example should output (if i was say, 12):
____________
NB: It does not necessarily have to be anything related to printf, however, it does have to be short.
Essentially, I would like to repeat one character a specified number of times and then output it.
Edit: I am currently using a for loops which allows me 31 characters, however by using a method similar to the above, I can cut down another 7 characters on top of that, due to the way the program is structured. So a loop is not really ideal.