Array of structs accessed with a pointer

I need to create an array of structs but cannot seem to get past the declaration. I would like to keep the struct and the array pointer in private in the header file. As far as what to do next, I have had no success.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
  // in .h
  struct Info
  {
    int x;
    int y;
  };

  Info *sPtr;

  // .cpp file

  Info *sPtr[2] = {0, 1, 2};
  cout << sPtr[1]->x << endl;



If you could just show a quick example of how to start and access x or something that would help a great deal.
Topic archived. No new replies allowed.