请教可以在自定义函数中调用结构体数组中的数据吗

求助:请问可以在自定义函数中调用结构体数组中的数据吗?
[color=#FF0000][/color]求助:请问可以在自定义函数中调用结构体数组中的数据吗?

------解决方案--------------------
当然可以,请参考下面的例子:
C/C++ code

#include <iostream>
using namespace std;

struct ASTRUCT
{
    int a;
    int b;
};

void printinfo(ASTRUCT arr[], int n)
{
    for(int i = 0; i < n; ++i)
    {
        cout << arr[i].a << "\t" << arr[i].b << endl;
    }
}

int main(int argc, char** argv)
{
    ASTRUCT s1 = {1, 1};
    ASTRUCT s2 = {2, 2};

    ASTRUCT array_ASTRUCT[2] = {s1, s2};

    printinfo(array_ASTRUCT, 2);

    return 0;
}

------解决方案--------------------
当然可以啊,在main函数中,定义一下结构体就行啦,比如说结构体名为struct A{int a[10]};
在main函数就写 A x(随便写什么),然后就x.a[10]就行了