CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 2010
    Location
    Poland
    Posts
    4

    How to assign array to another array?

    I am trying to make following assignment:

    int aTablica3D[2][2][2] = { { { 1, 2 }, { 2, 3 } },
    { { 3, 4 }, { 4, 5 } } };
    int aTablica2D[2][2];
    aTablica2D = aTablica3D[1];

    I have found a tutorial which contained this example. But it seem to not work with visual C++
    Anyone has any idea how to do it without a loop?

    I am using VC++2008 Express.

  2. #2
    Join Date
    May 2010
    Location
    Poland
    Posts
    4

    Re: How to assign array to another array?

    Here is error I receive when trying to compile:
    Error 4 error C2106: '=' : left operand must be l-value d:\programy\vc++\projects\tetris\tetris\block.cpp 17

  3. #3
    Join Date
    Sep 2004
    Location
    Holland (land of the dope)
    Posts
    4,123

    Re: How to assign array to another array?

    Arrays don't have a '=' operator. On other words, arrays don't know what to do with the '=' sign.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured