Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Managed C++/CLI
  4. Multidimension arrays

Multidimension arrays

Scheduled Pinned Locked Moved Managed C++/CLI
tutorialquestiondata-structuresperformancehelp
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Preminition
    wrote on last edited by
    #1

    Multidimension arrays Read dozens of examples given on website how to do an single array with the System::Array etc. But I can't get the hang of it how to use it properly. I keep getting error messages when I hit the build button. For example I want a simple 2 dimension array of the integer type. in the old code it was: int board[16][16]; board[3][3] = 5; if i try to use the managed version: array^ m_Board = gcnew array(16,16); for (int row = 0; row < 16;row++) { for (int col = 0; col < 16;col++) { m_Board[row][col] = 0; } } :confused: I get error message on my screen. Also I can't find anything about freeing the memory in the articles. Is it neccessary if you use it in a class. How do I free it if it's necessary? Can I change the size of the area dynamically? "Knowledge shouldn't be preserved by one, but shared with others." -- Preminition

    M 2 2 Replies Last reply
    0
    • P Preminition

      Multidimension arrays Read dozens of examples given on website how to do an single array with the System::Array etc. But I can't get the hang of it how to use it properly. I keep getting error messages when I hit the build button. For example I want a simple 2 dimension array of the integer type. in the old code it was: int board[16][16]; board[3][3] = 5; if i try to use the managed version: array^ m_Board = gcnew array(16,16); for (int row = 0; row < 16;row++) { for (int col = 0; col < 16;col++) { m_Board[row][col] = 0; } } :confused: I get error message on my screen. Also I can't find anything about freeing the memory in the articles. Is it neccessary if you use it in a class. How do I free it if it's necessary? Can I change the size of the area dynamically? "Knowledge shouldn't be preserved by one, but shared with others." -- Preminition

      M Offline
      M Offline
      Michael Dunn
      wrote on last edited by
      #2

      That should be array<int,2> not array<int^,2> since you want the array to contain ints.

      --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ VB > soccer

      1 Reply Last reply
      0
      • P Preminition

        Multidimension arrays Read dozens of examples given on website how to do an single array with the System::Array etc. But I can't get the hang of it how to use it properly. I keep getting error messages when I hit the build button. For example I want a simple 2 dimension array of the integer type. in the old code it was: int board[16][16]; board[3][3] = 5; if i try to use the managed version: array^ m_Board = gcnew array(16,16); for (int row = 0; row < 16;row++) { for (int col = 0; col < 16;col++) { m_Board[row][col] = 0; } } :confused: I get error message on my screen. Also I can't find anything about freeing the memory in the articles. Is it neccessary if you use it in a class. How do I free it if it's necessary? Can I change the size of the area dynamically? "Knowledge shouldn't be preserved by one, but shared with others." -- Preminition

        2 Offline
        2 Offline
        2bee
        wrote on last edited by
        #3

        Hello, you might want to read this article as well http://www.codeproject.com/managedcpp/cppcliarrays.asp[^] Best regards Tobias ;)

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups