cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
Meaning of expressions like"%d" in c++
Meaning of expressions like"%d" in c++
May 25, 2013 at 2:56pm UTC
The illusionist mirage
(235)
What is the meaning of expressions like "%d", "%c","%s" in C++
For example, what does the "%d" in the following code fragment stand for?
1
2
3
#include <stdio.h>
int
value = 10; printf(
"%d"
, value);
Thank You
May 25, 2013 at 3:04pm UTC
vlad from moscow
(6539)
It is
a conversion specifier character that specifies the type of conversion to be applied.
d,i The int argument is converted to signed decimal in the style [−]dddd
(the C Standard).
This meaans that value will be outputed as a signed decimal.
May 25, 2013 at 4:04pm UTC
dunnmifflsys
(32)
I typically don't like using %d, but it is used for a placeholder of an integer. %i also works for an integer, %c is a character, and %s is string.
Topic archived. No new replies allowed.