title: return local struct that have array member
body: <p>I read <a href="https://www.geeksforgeeks.org/return-local-array-c-function/" rel="nofollow noreferrer">How to return a local array from a C/C++ function?</a> topic and confused about the last code block of it:</p>
  <pre><code>#include &lt;iostream&gt; 
  using namespace std; 
  
  struct arrWrap { 
      int arr[100]; 
    ~arrWrap()
    {
      
    }
  }; 
  
  struct arrWrap fun() 
  { 
      struct arrWrap x; 
  
      x.arr[0] = 10; 
      x.arr[1] = 20; 
  
      return x; 
  } 
  
  int main() 
  { 
      struct arrWrap x = fun(); 
      cout &lt;&lt; x.arr[0] &lt;&lt; &quot; &quot; &lt;&lt; x.arr[1]; 
      return 0; 
  } 
  </code></pre>
  <p>can somebody analyze this for me what is the idea?</p>