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