Using "%s" with inputting numberic values
pascal111
judas.the.messiah.111 at gmail.com
Sun Jul 24 23:12:46 UTC 2022
In the next code, we used "%s" format with receiving an integer
value, while from C experience, we know that we use "%d" or "%i"
formats, so what "%s" stands for here, I guess it's for receiving
string data type?
import std.stdio;
void main() {
write("How many students are there? ");
/* The definition of the variable that will be used to
* store the information that is read from the input. */
int studentCount;
// Storing the input data to that variable
readf("%s", &studentCount);
writeln("Got it: There are ", studentCount, " students.");
}
More information about the Digitalmars-d-learn
mailing list