too many arguments for format [-Wformat-extra-args]

Your fprintf call has 8 format specifiers but passes 9 further arguments to fill these.

The 8th format specifier is %d; the argument corresponding to this is Item[i]->Name. The warning is telling you that Item[i]->Name is a string so can’t (shouldn’t) be converted to a signed integer.

I presume Item[i]->Price has type int; you then either need to add an extra %s to your format string (anywhere before the %d) or remove one of the string arguments.

Leave a Comment