How do I correctly initialize a wchar_t array with wmemset? Should I use '\0' or L'\0' ? Does it matter? does the encoding matter ? (unicode, ISO####)
eg
wchar_t arr[20];
wmemset(arr, '\0', sizeof(arr));
You need to use the L''
form to get a wchar_t
type, although any value that fits within a char
(such as '\0'
) will be automatically converted using the usual integer promotions. See character literal or C++ Character Literals.
It's unclear to me what code page the source will be interpreted in. To be safe, it's best to use a L'\u20ac'
or L'\U000020ac'
form to specify characters outside of the ASCII character set.