hi there am wondering about the space between the " and the %
scanf(" %c",&choice);
what's the different if i leave no space?
Try it and see. Include leading whitespace in your input string.
p.s. Come up with better thread titles. I very nearly reported this thread as a duplicate, and I'll refuse to help for future questions titled "need help with Dev C++".
ok thanxx
There are some special characters like '\' which we use for '\n' etc. If we leave a space then the compiler will not recognize it as a special command and just treats it as a character in a string.
There are some special characters like '\' which we use for '\n' etc. If we leave a space then the compiler will not recognize it as a special command and just treats it as a character in a string.
Um, no.
just treats it as a character in a string.
Yes, I have made a mistake there. The compiler doesn't treat it as a character.
The compiler doesn't treat it as a character.
Closer. A whitespace character in the scanf format string is treated as "any kind and amount of whitespace". scanf format specifiers trim leading whitespace, with the exception of %c, %[, and %n, so " %c" is a way of adding that functionality to a specifier that doesn't normally include it.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.