scanf之變數參數
| type | Qualifying Input | |
|---|---|---|
| c | Single character: Reads the next character. If a width different from 1 is specified, the function reads width characters and stores them in the successive locations of the array passed as argument. No null character is appended at the end. | |
| d | Decimal integer: Number optionally preceded with a + or - sign. | |
| e,E,f,g,G | Floating point: Decimal number containing a decimal point, optionally preceded by a + or - sign and optionally folowed by the e or E character and a decimal number. Two examples of valid entries are -732.103 and 7.12e4 | |
| o | Octal integer. | |
| s | String of characters. This will read subsequent characters until a whitespace is found (whitespace characters are considered to be blank, newline and tab). | |
| u | Unsigned decimal integer. | |
| x,X | Hexadecimal integer. |
【範例】
|
|
執行結果: |