char s[50];

輸入: Hello there world. How are you today?
  格式 進階輸入句子 註解 s 值
1 %[^\n] scanf("%[^\n]", s) ; 直至出現 \n 為止 Hello there world.
How are you today?
2 %[elHo] scanf("%[elHo]", s) ; 只容許 elHo Hello
3 %[^rw] scanf("%[^rw]", s) ; 直至出現 r 或 w Hello the
4 %[^H] scanf("%[^H]", s) ; 直至出現 H 為止