C language scan matching