##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# std::wmemset

From cppreference.com
< cpp‎ | string‎ | wide

Defined in header `<cwchar>` |  |
wchar_t* wmemset( wchar_t* dest, wchar_t ch, std::size_t count ); |  |

Copies wide character `ch` into each of the first `count` wide characters of the object pointed to by `dest`. If the object is not trivially-copyable (e.g., scalar, array, or a C-compatible struct), the behavior is undefined. If dest+size+1 points outside the object, the behavior is undefined.

### [edit] Parameters

dest | - | pointer to the object to fill
ch | - | fill byte
count | - | number of wide characters to fill

### [edit] Return value

`dest`

### [edit] Example

Run this code

    #include <iostream>
    #include <cwchar>

    int main()
    {
        int a[20];
        std::memset(a, 0, sizeof(a));
        std::cout << "a[0] = " << a[0] << '\n';
    }

Output:

    a[0] = 0

### [edit] See also

wmemcpy | copies a certain amount of wide characters between two non-overlapping arrays (function) [edit]
fill_n | assigns a value to a number of elements (function template) [edit]
is_trivially_copyable (C++11) | checks if a type is trivially copyable (class template) [edit]
C documentation for wmemset

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/string/wide/wmemset&oldid=59154"