Is there a “null” printf code that doesn't print anything, used to skip a parameter?
问题 If I want a program to have multiple text output formats, I could do something like this: const char *fmtDefault = "%u x %s ($%.2f each)\n"; const char *fmtMultiLine = "Qty: %3u\nItem: %s\nPrice per item: $%.2f\n\n"; const char *fmtCSV = "%u,%s,%.2f\n"; const char *fmt; switch (which_format) { case 1: fmt = fmtMultiLine; break; case 2: fmt = fmtCSV; break; default: fmt = fmtDefault; } printf(fmt, quantity, item_description, price); Since the price is specified last, I could also add one that