basic.carbon 467 B

1234567891011121314151617181920212223
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. //
  5. // AUTOUPDATE
  6. // CHECK:STDOUT: result: 0
  7. package ExplorerTest api;
  8. fn Main() -> i32 {
  9. var x: i32 = 5;
  10. // changes x to 10
  11. x = 10;
  12. var p: i32* = &x;
  13. // changes x to 7
  14. *p = 7;
  15. var q: i32* = &*p;
  16. // changes x to 0
  17. *q = 0;
  18. var y: i32 = *p;
  19. return y;
  20. }