Is the following code well defined?
#include int ScanFirstOrSecond(const char *s, int *dest) { return sscanf(s, \"%d%d\", dest, dest); }
Yes, well defined. It means "read the first token into *dest, then read the second token into *dest again". It's weird but legal. Yes, because sscanf() executes directives in the format string in strict order.