Skip to content

Instantly share code, notes, and snippets.

@yuyu2172
Last active January 20, 2018 02:28
Show Gist options
  • Save yuyu2172/871ff7b5274b67b882ccb2dd0eab34b1 to your computer and use it in GitHub Desktop.
Save yuyu2172/871ff7b5274b67b882ccb2dd0eab34b1 to your computer and use it in GitHub Desktop.
void set_integer_ref(int& x)
{
x = 100;
}
void set_integer_ptr(int* x)
{
*x = 200;
}
void set_integer_ref_ptr(int*& x)
{
x = new int[1];
*x = 300;
}
void set_integer_ptr_ptr(int** x)
{
*x = new int[1];
*x[0] = 400;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment