What do %d, %s and other things like that do, and what are they called?
Printable View
What do %d, %s and other things like that do, and what are they called?
well these were used in operations in C...you could still use it in C++, but why would you :p
%d is used for ints I believe it stands for "decimal" and %s is used for strings, er char arrays...
for example:
Code:int x=3;
char *foo = "bar";
printf( " this is the number: %d and this is the string: %s", x, foo );
//prints out: this is the number: 3 and this is the string: bar
C style format flags used with I/O routines like printf() and scanf().
but how does it kno which number to use and which char array to use?
printf( " this is the number: %d and this is the string: %s", x, foo );
look at the code DeepFyre, x=3, and foo=bar;
It accepts an "unlimited" number of arguments, by order of where the % operators are used.Code:printf( " this is the number: %d and this is the string: %s", x, foo );
yea i know that axon, but what if there were more variables?
>>by order of where the % operators are used.
so would it use the first number/string it comes upon?
EDIT:: yes, that is why he said by order
So the first %d in your code will respond to the first argument after the string. And the second %whatever will respond to the second argumentand so onQuote:
Originally Posted by Vicious
[edit]
ah axon again! :D
[edit2]
Ah all the edits! :confused:
k, thanks a lot guys! :D
>>ah axon again!<<
you know that my middle name is flash_gordon :D