title: Can I compare 2 structures in C++?
body: <p>I have simply declared a structure like this -</p>
  
  <pre><code>struct data{
      int x,y;
  };
  </code></pre>
  
  <p>Now I have declared 2 variables <code>a</code> &amp; <code>b</code> of <code>data</code> type. I've assigned appropriate values to them. Now, I want to check if they are equal! I am trying to do like this -</p>
  
  <pre><code>data a,b;
  a.x=12, a.y=24;
  b.x=15, b.y=30;
  if(a!=b)cout&lt;&lt;"a~b"&lt;&lt;endl;
  </code></pre>
  
  <p>But the compiler is giving me the following error on the <code>4th</code> line -></p>
  
  <p><code>error: no match for 'operator!=' (operand types are 'data' and 'data')</code></p>
  
  <p>Where is the problem actually? Isn't this compare supported in C++?? Or I'm making any mistakes?? </p>
  
  <p>What is the exact and easiest way to do this?? Do I need to compare each of the elements in the structure separately?? Or there's any other smarter way??</p>