Quote Originally Posted by chrishappy11 View Post
Sorry...
In addition, There array EAI[9][9] ,Rp[9] are constant array, I declare other where.
If I return array in another function,
Again, you cannot return arrays. What you are doing is something else other than returning an array. Maybe your description of what you're doing is not correct. You can pass a pointer to the first element of the array, or you can wrap the array in a struct and return the struct, but you cannot return the array.

What your original code was doing was returning a single element of the array, namely element 9, and not an array. Here is a synopsis of the code you wrote:
Code:
double SomeFunction()
{
    double SomeArray[9];
    //...
    return SomeArray[9];  // This does not return an array!
}
That returns a single value, SomeArray[9]. This is what your code was doing. Not only does it not return an array, it returns an item from an invalid index in the array -- there is no element 9, as the array is indexed from 0 to 8 (just as Philip pointed out).

Also, please see what Philip pointed out -- you are accessing an invalid index in the array, causing the program to have undefined behaviour. When you access an invalid element in the array, the program may "work", may crash, or can change other values that you didn't suspect causing invalid values to be used.

If you are a beginner in C++, it is imperative you know exactly what you're doing when you write a program. If you don't know about how to handle arrays, i.e. passing and returning from functions, then you need to study that and write simpler programs giving you practice in doing this, instead of trying to write full-blown C++ programs and not know the basics of C++.

Regards,

Paul McKenzie