Function return an array?

 

Hi,

How to define the return value as an array?

I wrote like this, but it was compiled wrong,

string[] A();

 
hanxu:

Hi,

How to define the return value as an array?

I wrote like this, but it was compiled wrong,

string[] A();

You can't. Please read the documentation :

The return operator can return the value of an expression located in this operator. If necessary, the expression value is converted to the function result type. What can be returned: simple types, simple structures, object pointers. With the return operator you can't return any arrays, class objects, variables of compound structure type.

You have to pass an array by reference.

Reason: