0

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

3

I guess that you have done this

int i = 5;
printf(""%d,i);

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

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

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 .