I am going through some examples in a book I have and I have come to something I’ve never seen before nor understand:
scanf("%d-%d-%d-%d-%d", &prefix, &group, &publisher, &item, &check_digit);
This code is part of a program that asks the user to enter their ISBN number of a book and later on breaks down the ISBN into Prefix = x, Group = y, etc..
I have NEVER seen the hypens between the %d‘s. Does anyone see any point in this??
Thanks
“Pattern matching”. If the input doesn’t fit the specified pattern (also called format), it fails. So if you input anything else than
INT-INT-INT-INT-INT(whereINTis a placeholder for an integer you input), the input would be considered invalid.