title: Printf changing memory values
body: <p>I'm trying to do some fixed point vector math and it seems that whenever I print anything, doesn't seem to matter what. The value of my vectors change. The code is compiled using ZDSII developer studio from Zilog.</p>
  
  <p>I have a struct defined like so</p>
  
  <pre><code>typedef struct {
      long x;
      long y;
  } vector;
  </code></pre>
  
  <p>The values inside the struct are initialized in a function</p>
  
  <pre><code>void initVector( vector * vec, int x, int y ) {
      vec -&gt; x = (long) x &lt;&lt; 14;
      vec -&gt; y = (long) y &lt;&lt; 14;
  }
  </code></pre>
  
  <p>In my main function I have</p>
  
  <pre><code>int main() {
      vector * vector1;
  
      initVector( vector1, 1, 2 );
      printf( "foo" ); // this prints alright
      printf( "%d , %d", vector1 -&gt; x &gt;&gt; 14, vector1 -&gt; y &gt;&gt; 14 ); //garbage
      ...
  
      ...
  }
  </code></pre>
  
  <p>Which prints garbage. The values will change depending on the number of printf statements before the printf where I actually print the values.</p>