title: Increment content of pointer
body: <p>I am trying to increment a value in C and return the old value, and I am doing that using a pointer. The problem is that the new value is still 0 even though I am using pointer.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  int increment (int *mem) {
      int tmp;
      tmp = *mem;
      *mem++;
      return tmp;
  }
  
  int main () {
      int a = 0;
      printf("The old value of a is \t %d", increment(&amp;a));
      printf("The new value of a is \t %d", a);
  }
  </code></pre>
  
  <p>Now when I run this method I get the same value for a that is 0; I was expecting 1 in the second printf. I don't know what I am doing wrong here.</p>