Skip to content

Instantly share code, notes, and snippets.

@robgough
Created May 17, 2011 10:25
Show Gist options
  • Save robgough/976254 to your computer and use it in GitHub Desktop.
Save robgough/976254 to your computer and use it in GitHub Desktop.
passing by ref
public int AddOnePassByValue(int input)
{
return input + 1;
}
public int AddOnePassByRef(ref int input)
{
input + 1;
return -1;
}
public void main()
{
int rob = 1;
output = AddOnePassByValue(rob); //OUTPUT rob=1, output=2
output = AddOnPassByRef(rob); //OUTPUT rob=2, output=-1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment