tuple_pointer.carbon 469 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: 3
  7. // CHECK:STDOUT: 4
  8. // CHECK:STDOUT: result: 0
  9. package ExplorerTest api;
  10. fn Main() -> i32 {
  11. var a: (i32, i32) = (1, 2);
  12. var p: (i32, i32)* = &a;
  13. a[0] = 3;
  14. Print("{0}", (*p)[0]);
  15. (*p)[1] = 4;
  16. Print("{0}", a[1]);
  17. return 0;
  18. }