The getchar() that is there now, is sucking in the newline character that was left from the scanf(). Do it again and you'll be coolio.
The getchar() that is there now, is sucking in the newline character that was left from the scanf(). Do it again and you'll be coolio.
Mainframe assembler programmer by trade. C coder when I can.
Can someone help me with DATA TYPES
int = %d
char = %s
float = %f
double = %?
or is double and %f?!?!?
and what's your technique to remembering them? Do you just know?
Last edited by LuizCPFL; 12-08-2008 at 06:39 PM.
int = %d
char = %c
string = %s
float = %f
double = %lf
hex = %x or %X
pointer = %p
Technique to remember? The same technique you learn your new girlfriend's name - you just do it right.
Mainframe assembler programmer by trade. C coder when I can.
for printf, %f is both float and double. For scanf, %lf for double, %f for float.
%s is for char[], %c for a single char.
And yes, I know those, and %u, %x, %o, %p, %zu, %lld, %ld, %hd. Any others, I'll look up when I need them.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
Thank you I was looking for a list like that.
I will make sure that I memorize it lol
You may want to look at this one:
http://www.cppreference.com/wiki/c/io/scanf
and it's printf sibling, as it's got a more complete and accurate account of the standard variants.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.