title: Value of Passed-By-Value Struct Does Not Change
body: <p>I am trying to understand how to pass a struct by reference in order to create a linked list. The method I am using is similar to the example code given below. However, when this code is run, the *tester declared in the main function always stays as NULL. Is the passing of a struct to the addNode() function in this way inappropriate (the compiler does not raise any warnings)?</p>
  
  <pre><code>struct test{
    int num;
    struct test *next;
  };
  void addNode (int num, struct test* tester);
  
  int main (void){
    struct test *tester = null;
    addNode(1, tester);
  }
  
  void addNode(int num, struct test* tester){
    struct test *example = malloc(sizeof(struct test));
    example-&gt;num = num;
    if (tester == NULL){
      tester = example;
    } else{
      tester-&gt;next = example;
    }
  }
  </code></pre>