Assign one array to another array

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ekailan
    New Member
    • Oct 2010
    • 11

    #1

    Assign one array to another array

    Code:
    wchar_t a[50];
    wchar_t b[50];
    
    a=L"asdfgh";
    why I cant say

    b=a;

    How to exchange values between tow wchar_t arrays
    Last edited by Markus; Oct 31 '10, 02:49 PM. Reason: Fixed [code] tags
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    You can't say b=a because the name of an array is the address of element 0.

    The compiler will not let you chnage the address of a local variable.

    You will need to copy one array to the other element by element.

    Your problem has nothing to to with wchar_t but everything to do with arrays.

    You might read: http://bytes.com/topic/c/insights/77...rrays-revealed

    Comment

    Working...