Compare address : structure pointer « Structure « C++ Tutorial






#include <ios>
#include <iostream>
#include <ostream>

struct MyStruct {
  int x;
  int y;
};

int main()
{
  MyStruct demo[10];
  std::cout << std::boolalpha;

  std::cout << (&demo[0]   < &demo[2])   << '\n';
  std::cout << (&demo[0]   == demo)      << '\n';
  std::cout << (&demo[10]  > &demo[9])   << '\n';
  std::cout << (&demo[0].x < &demo[0].y) << '\n';

}
true
true
true
true








8.4.structure pointer
8.4.1.Define pointer for structure
8.4.2.Pointers to structures
8.4.3.Use -> for structure pointer
8.4.4.Compare address