I am having trouble getting a simple pass by reference to work the way I expect. Fist off, when I compile, I get the following warning:
warning: value computed is not used [-Wunused-value]
Second, I expect it to print a 2, not a 1 at the end of the program.
$ ./testAdd
1
Here is the simple code:
#include <stdio.h>
void addone(int *j) {
  *j++;
}
int main(int argc, char *argv[])
{
  int i = 1;
  addone(&i);
  printf("%d\n", i);
  return 0;
}
What is going wrong here?
 
    