I am passing a pointer to a function with intent of modifying the data kept at the original address.
#include<bits/stdc++.h>
using namespace std;
void square(int **x)
{
    **x = **x + 2;
    cout<<**x<<" ";
}
int main()
{
    int y = 5;
    int *x = &y;
    cout<<*x<<" ";
    square(&x);
    cout<<*x<<" ";
    return 0;
 }
I am able to get the desired output using this code, i.e 5 7 7
Just wanted to know if there is a better/easy to read way of handling this.
 
     
    