#include using namespace std; struct S { int a; double b; char c[10]; }; void f (S x) { x.a = 10; } void g (S z[10]) { //z[0].a = 10; //z->a = 10; //z[2].a = 10; //*(z+2).a = 10; //(z+2)->a = 10; } bool hasDuplicateBs (S z[], int n) { for (int i = 0; i < n; i++) { for (int j = i+1; j < n; n++) { if (z[i].b == z[j].b) return true; } } return false; } int main () { S x[5], y[10]; //.... cout << hasDuplicateBs (x,5); cout << hasDuplicateBs (y,10); x[2].a = 0; //f (x[0]); cout << x[0].a << endl; g (x); cout << x[2].a << endl; }