char str[] = \"beautiful earth\"; memset(str, \'*\', 6); printf(\"%s\", str); Output: ******ful earth
Like the above use of memset, can we initial
On Linux, OSX and other UNIX like operating systems where wchar_t is 32 bits and you can use wmemset() instead of memset().
wchar_t
wmemset()
memset()
#include ... int arr[15]; wmemset( arr, 1, 6 );
Note that wchar_t on MS-Windows is 16 bits so this trick may not work.