Guest User

Untitled

a guest
Apr 23rd, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.23 KB | None | 0 0
  1. void foo(int *x) {
  2. *x = 2; // x的地址作为参数被传递,x的地址是pass by value,在foo的stack里被复制了一份,然后我们修改对应地址的值。
  3. }
  4.  
  5. int main() {
  6. int x = 1;
  7. foo(&x);
  8. printf("x: %d\n", x);
  9. }
Add Comment
Please, Sign In to add comment