2 dimensional array

creating a 2 dimensional array

Page 1 of 1

1 Replies - 2086 Views - Last Post: 27 December 2010 - 11:15 AM

#1 bvds2010  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 22-December 10

2 dimensional array

Posted 27 December 2010 - 10:09 AM

An array of type System::String^ of 10 elements can be initialized like this:
array<String^>^ strArray = gcnew array<String^>(10);

But what if I want to initialize a 2 dimensional array of type System::String^ ,and put some strings inside?
Thank you...
Is This A Good Question/Topic? 0
  • +

Replies To: 2 dimensional array

#2 Martyr2  Icon User is offline

  • Programming Theoretician
  • member icon

Reputation: 4332
  • View blog
  • Posts: 12,127
  • Joined: 18-April 07

Re: 2 dimensional array

Posted 27 December 2010 - 11:15 AM

You specify the dimension with it...

// Two dimension array, 10 x 10, note this is not an array of arrays
array<String^, 2>^ str2Dimension = gcnew array<String^, 2>(10,10);

str2Dimension[0,0] = gcnew String("hello world");

MessageBox::Show(str2Dimension[0,0]);



Enjoy! :)

This post has been edited by Martyr2: 27 December 2010 - 11:16 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1