### 8.30 `wcwidth`—number of column positions of a wide-character code ¶

Synopsis

    #include <wchar.h>
    int wcwidth(const wint_t wc);

Description
The `wcwidth` function shall determine the number of column positions required for the wide character wc. The application shall ensure that the value of wc is a character representable as a wint_t (combining Unicode surrogate pairs into single 21-bit Unicode code points), and is a wide-character code corresponding to a valid character in the current locale.

Returns
The `wcwidth` function shall either return 0 (if wc is a null wide-character code), or return the number of column positions to be occupied by the wide-character code wc, or return -1 (if wc does not correspond to a printable wide-character code).

Portability
`wcwidth` has been introduced in the Single UNIX Specification Volume 2. `wcwidth` has been marked as an extension in the Single UNIX Specification Volume 3.