c - better way of printing data with same format -


is there way in c can specify format output once , use printf statement. example in below code want print 10 decimal numbers , know format %d 10 numbers. numbers not stored in array otherwise have put printf in loop. wanted know if there neater way of doing it.

printf("%d%d%d%d%d%d%d%d%d%d\n"1,2,3,4,5,6,7,8,9,10); 

if there definite pattern in example, can still use loop.

for (int = 1; <= 10; i++)     printf("%d", i); printf("\n"); 

if there isn't, should using array anyways.

finally, if issue have lot of literal numbers, can consider reading them data file instead of embedding them source file.


Comments