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