Take the 2-minute tour ×

I am doing Visual c++ programming, I have created a CLR console application. I have noticed that String arrays should be declared like String ^, not String[]. What is the use of ^? And why is it being used instead of []? And is this substitution limited only to CLR applications? Here is a line of the code and the error:

array<String[]>[] abc;

the errors generated were

error C2143: syntax error : missing ';' before '['

error C2146: syntax error : missing ';' before identifier 'abc'

eror C2065: 'abc' : undeclared identifier

share|improve this question

1 Answer 1

The circumflex accent means that the object is a managed pointer,it'll be automatically collected by the Garbage Collector - you don't need to do this implicitly. Please take a look at this article to understand how arrays work in C++/CLI.

In your case:

array<String^> ^abc;

And is this substitution limited only to CLR applications?


share|improve this answer

Your Answer


