title: Return memory address as out parameter in function
body: <p>I need to store the memory address of a string in an int pointer out parameter. I've created the code below to test the implementation. </p>
  
  <pre><code>void getMemAddress (int *a) {
  
      char str[80] = "Hello world";
  
      a = (int*)&amp;str; // Assign memory address of str to a
  
      printf("%s", (char*)a);
  }
  
  int main(int argc, const char * argv[]) {
  
      int *memaddress;
  
      getMemAddress(memaddress);
  
      printf("%s", (char*)memaddress);
  
      return 0;
  }
  </code></pre>
  
  <hr>
  
  <pre><code>printf("%s", (char*)a);
  </code></pre>
  
  <p>prints "Hello World" as it should but </p>
  
  <pre><code>printf("%s", (char*)memaddress); 
  </code></pre>
  
  <p>prints null</p>
  
  <p>How could I go about retrieving the actual memory address as using it to access the original string?</p>
  
  <p>Thanks!</p>