title: Is a struct copied when a stack-variable is initialized by a result of a function call?
body: <p>Given I'll return a large struct in a function like here:</p>
  <pre><code>#include &lt;stdio.h&gt;
  
  // this is a large struct
  struct my_struct {
     int x[64];
     int y[64];
     int z[64];
  };
  
  struct my_struct get_my_struct_from_file(const char *filename) {
      int tmp1, tmp2; // some tmp. variables
      struct my_struct u;
      // ... load values from filename ...
      return u;
  }
  
  int main() {
      struct my_struct res = get_my_struct_from_file(&quot;tmp.txt&quot;); // &lt;-- here
      printf(&quot;x[0] = %d\n&quot;, res.x[0]);
      // ... print all values ...
  }
  </code></pre>
  <p>At the place marked by <code>here</code>, do I have to assume that this large struct is copied or is it likely that the compiler does something to avoid this?</p>
  <p>Thank you</p>