wchar_t pointer

arrays, c++, pointers

Solution

Your code has two issues.

First, `"Tony"` is a pointer to a string of `char`'s. `L"Tony"` is the appropriate wide string.

Second, you allocate a single `wchar_t` via new, then immediately lose track of it by reassigning the pointer to Tony. This results in a memory leak.

Problem

What's wrong with this: ``` wchar_t * t = new wchar_t; t = "Tony"; ``` I thought I could use a wchar_t pointer as a string...

Original source

Related problems