How do I print the values of a variable?

1 Answer 1


You can print the value of a variable by using placeholders. Each variable type has a different placeholder. Ex: To print out a string called x, write this: printf("%s\n", x);

More info: http://shangyilim.blogspot.com/2009/02/placeholders-placeholders-are-used-to.html

  • Is it more of a convention? Are there interchangeable? I replaced %d by %i in one of my code, and still got the desired outcome (an integer).
    – Chloe
    Sep 1, 2015 at 14:11

You must log in to answer this question.

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