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 ?
#include<bits/stdc++.h>
using namespace std;
void getAddress(int *ptr){
    int *temp=(int*)malloc(sizeof(int));
    ptr=temp;
    cout<<ptr<<endl;
} 
int main(){
    int *ptr=NULL;
    cout<<ptr<<endl;
    getAddress(ptr);
    cout<<ptr<<endl;
    return 0;
}
output : 
0
0x6fa010
0
Expected output :
0
0x6fa010
0x6fa010
 
     
    