I'm writing a program that displays all the info in an array. It has to start with the array index in brackets (e.g. [2]) and they have to be right aligned with each other.
if it was just the number, I know that you can do:
printf("%-10d", index); but putting brackets around that would give the following output
[ 1] [ 2] ... [ 10] [ 11] when I really want it to be:
[1] [2] ... [10] [11] How do I go about doing this?