What is the meaning of sprintf(): Too few arguments

You have two %s items in the string but only one parameter supplied after the string. For each ‘%’ item in the format string it expects a matching parameter after the string to use to find in the value.

like this:

sprintf("item 1: %s, item 2: %s", "item1", "item2");

what you have is like:

sprintf("item 1: %s, item 2: %s", "item1");

so there is no entry for the item 2 string to match

Leave a Comment