Advertisement
Guest User

Untitled

a guest
Jul 4th, 2019
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. const std = @import("std");
  2.  
  3. const TwoPointers = struct {
  4. ptr1: [*]const u8,
  5. ptr2: [*]const u8,
  6. };
  7.  
  8. pub fn main() void {
  9. var tpInMain = TwoPointers {.ptr1 = "hello"[0..].ptr, .ptr2 = "a"[0..].ptr + 5};
  10. std.debug.warn("&tpInMain = {}\n", @ptrToInt(&tpInMain));
  11. foo(tpInMain);
  12. }
  13.  
  14. fn foo(tpInFoo: TwoPointers) void {
  15. std.debug.warn("&tpInFoo = {}\n", @ptrToInt(&tpInFoo));
  16. var tpCopyInFoo = tpInFoo;
  17. std.debug.warn("&tpCopyInFoo = {}\n", @ptrToInt(&tpCopyInFoo));
  18. //value += 1;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement