How do I print the values of a variable?
1 Answer
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).– ChloeCommented Sep 1, 2015 at 14:11