basic.carbon 468 B

123456789101112131415161718192021222324
  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. package ExplorerTest api;
  7. fn Main() -> i32 {
  8. var x: i32 = 5;
  9. // changes x to 10
  10. x = 10;
  11. var p: i32* = &x;
  12. // changes x to 7
  13. *p = 7;
  14. var q: i32* = &*p;
  15. // changes x to 0
  16. *q = 0;
  17. var y: i32 = *p;
  18. return y;
  19. }
  20. // CHECK:STDOUT: result: 0