This is an excerpt of my code:

printf{"%c, t"};

But it has an error that says:

mario.c:17:18: error: more '%' conversions than data arguements [-Werror, -Wformat] printf("%c, t"); ~^ 1 error generated. make: *** [mario] Error 1

Thank you!


The syntax of your print statement is not correct. First, it doesn't work with curly braces {}. It uses parentheses. Next, the text to be printed is placed inside double quotes, but the variables to be used appear in order following the closing quotes and separated by commas, with one variable for each variable formatting marker inside the parentheses. So, assuming in your example that t is a char variable, your code should have looked like this:

printf("%c", t );

You could benefit a lot from reviewing the class material on syntax for various code. You'll be seeing a lot of syntax errors like this in the next few weeks, so it will help you a lot to figure out how to interpret these errors.

If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)

  • I didn't use curly brackets...but anyways I got it!
    – sophiemath
    Dec 29 '15 at 19:05

Missing the quotation marks after %c.

  • Look closer. There is a closing quote, but the placement makes the statement wrong.
    – Cliff B
    Jan 1 '16 at 8:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .