Skip to content

Instantly share code, notes, and snippets.

@kmizu
Created May 7, 2017 18:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kmizu/4164df4fa6aaf0a35750eb66196bdf41 to your computer and use it in GitHub Desktop.
Save kmizu/4164df4fa6aaf0a35750eb66196bdf41 to your computer and use it in GitHub Desktop.
ある言語の引数評価戦略が、「値渡し」か「参照渡し」かを機械的に見分ける簡単な方法 ref: http://qiita.com/kmizu/items/20052fbaee1fe6b3e5ed
void swap(int x, int y) {
int tmp = x;
x = y;
y = tmp;
}
def swap(x, y)
tmp = x
x = y
y = tmp
end
int x = 1;
int y = 2;
swap(x, y);
printf("x = %d, y = %d\n", x, y);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment