locked
Why I have error RRS feed

  • Question

  • TCHAR tchelloText[500];

    int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
                                                    LPSTR lpszCmdLine, int nCmdShow)
    {

    tchelloText = TEXT("Hello Win32");

    }

    Why I have error

    expression must be a modifiable lvalue 

    Tuesday, December 20, 2016 6:19 AM

Answers

  • On 12/20/2016 1:19 AM, Ahlompys wrote:

    TCHAR tchelloText[500];

    int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
                                                    LPSTR lpszCmdLine, int nCmdShow)
    {

    tchelloText = TEXT("Hello Win32");

    }

    Why I have error
    expression must be a modifiable lvalue

    You can't assign to an array. You can initialize the array:

    TCHAR tchelloText[500] = TEXT("Hello Win32");

    and you can modify the contents of the array, e.g.

    lstrcpy(tchelloText, TEXT("Hello Win32"));
    • Marked as answer by Ahlompys Tuesday, December 20, 2016 2:16 PM
    Tuesday, December 20, 2016 1:44 PM