编程语言
首页 > 编程语言> > C# pointer to array

C# pointer to array

作者:互联网

void arrDemo8()
{ 
    int* p;
    p = returnArr();
    cout << typeid(p).name() << endl;
    for (int i = 0; i < 10; i++)
    {
        cout << *(p+i) << endl;
    }
}

int*  returnArr()
{
    static int arr[10];
    for (int i = 0; i < 10; i++)
    {
        arr[i] = i * i;
    }
    return arr;
}

 

标签:cout,C#,void,returnArr,int,arrDemo8,array,pointer
来源: https://www.cnblogs.com/Fred1987/p/15224881.html