title: Writing to/reading from file using pointers, C
body: <p>I've written a program to mess around with writing pointers into files(fwrite) and reading into pointers from files(fread). However the program doesn't seem to write a single thing into the file, nor does it seem to read anything from the file; it just prints the final incrementation of my pointer 5 times and exits. Can anyone spot the error/mistake in my syntax that seems to be doing this? </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>#include &lt;stdio.h&gt;
  
  int main() {
      FILE *fTest;
      int *testPtr;
      int x = 10;
      
      if ((fTest = fopen("test.c", "wb")) == NULL) {
          printf("Error!");
      }
  
      testPtr = &amp;x;
      int i;
      for (i = 0; i &lt; 5; i++) {
          fwrite(testPtr, sizeof(int), 1, fTest);
          *testPtr += 1;
      }
      
      for (i = 0; i &lt; 5; i++) {
          fread(testPtr, sizeof(int), 1, fTest);
          printf("%d", *testPtr);
      }
  
      fclose(fTest);
  }</code></pre>
  </div>
  </div>
  </p>