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. problem Facing with c++/cli arrays

problem Facing with c++/cli arrays

Scheduled Pinned Locked Moved Managed C++/CLI
helpc++data-structures
2 Posts 2 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.
  • N Offline
    N Offline
    Nagaraju_Focus
    wrote on last edited by
    #1

    Hi All, In C++/CLI I have used a 2 Dimensional String Array. My code: array ^strarr=gcnew array(2,2){"focus1","focus2","focus3","focus4",}; and when I want a string to print on console ie Console::Writeline("{0}",strarr[0][0]); compiler is giving Error. can any one suggest Bye.. :^) G.Nagaraju

    2 1 Reply Last reply
    0
    • N Nagaraju_Focus

      Hi All, In C++/CLI I have used a 2 Dimensional String Array. My code: array ^strarr=gcnew array(2,2){"focus1","focus2","focus3","focus4",}; and when I want a string to print on console ie Console::Writeline("{0}",strarr[0][0]); compiler is giving Error. can any one suggest Bye.. :^) G.Nagaraju

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

      Hi, if want to directly initialize your array then you'll have to do it like this:

      array<String^,2>^ strarr = gcnew array<String^,2>{{"focus1","focus2"},{"focus3","focus4"}};
      Console::WriteLine("{0}",strarr[0,0]);
      

      In additon I would recommend you to read this article. 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