title: Example of a translation unit vs file scope
body: <p>Taking the following program as an example:</p>
  <pre><code>// myprogram.c
  #include&lt;stdio.h&gt;
  int a, b;
  int main(void)
  {
      printf(&quot;A: %d\n&quot;, a);
      printf(&quot;B: %d\n&quot;, b);
  }
  </code></pre>
  <pre><code>// friendsprogram.c
  int a=1;
  static int b=2;
  </code></pre>
  <pre><code>$ gcc myprogram.c friendsprogram.c -o out; ./out
  </code></pre>
  <blockquote>
  <p>A: 1 <br />
  B: 0</p>
  </blockquote>
  <p>How would the translation units be classified in the above?  And how what that be different than just the contents of the file &quot;myprogram.c&quot; and &quot;friendsprogram.c&quot;? Does the translation unit ever depend on the command that is issued to the compiler? For example, If I change the command to just:</p>
  <pre><code>$ gcc myprogram.c -o out; ./out
  </code></pre>
  <p>My output becomes:</p>
  <blockquote>
  <p>A: 0 <br />
  B: 0</p>
  </blockquote>