#include <stdio.h> #include <wctype.h> int main () { int i; wchar_t str[] = L"c3p。o..."; i=0; while (iswalnum(str[i])){ i++; } printf("The first %d characters are alphanumeric. ",i); return 0; }
输出
The first 3 characters are alphanumeric.