Skip to content

Conversation

timholzhey
Copy link

Closes #25546, #22045 and #23506.

This code now compiles correctly:

var arr: [1]u8 = .{0};
const arr_c_ptr = @as([*c][1]u8, &arr);
arr_c_ptr.*[0] = 1;

For pointer address calculation, [*c]arr[idx] can be treated a single-item pointer *arr[idx]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

C Pointer via ptrFromInt of extern struct with array field cannot be dereferenced and indexed

2 participants