title: Is it possible that a function return a pointer using its parameters ?
body: <p>i have a function that dynamically allocates memory and keeps the address in its local pointer. I want that address in the caller function.
  Yes, i can do that using return.But is it possible to do that using the function's parameters ?</p>
  
  <pre><code>#include&lt;bits/stdc++.h&gt;
  using namespace std;
  void getAddress(int *ptr){
      int *temp=(int*)malloc(sizeof(int));
      ptr=temp;
      cout&lt;&lt;ptr&lt;&lt;endl;
  } 
  int main(){
      int *ptr=NULL;
      cout&lt;&lt;ptr&lt;&lt;endl;
      getAddress(ptr);
      cout&lt;&lt;ptr&lt;&lt;endl;
      return 0;
  }
  output : 
  0
  0x6fa010
  0
  
  Expected output :
  0
  0x6fa010
  0x6fa010
  </code></pre>