In a printf statement I get an error message that says the d in %d is undeclared. How do I declare it?

2 Answers 2


I guess that you have done this

int i = 5;

It's wrong, the corrected syntax is given below.

int i = 5;
  • What I have is printf("text "%d", x ); and the machine doesn't like the d and the " after the d.
    – Gene
    Aug 31, 2014 at 16:26

Your problem is that you have three quote marks inside your print statement. Quote marks must be in pairs only. There are many examples of how to use placeholders throughout the lectures, shorts, sections etc.

You must log in to answer this question.

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