digitalmars.D.learn - typo mapNode[6]* exits; instead of mapNode*[6] exits; but whats it
- Codifies (5/5) Oct 10 2018 I'm not sure I understand what mapNode[6]* means! (the second
- Simen =?UTF-8?B?S2rDpnLDpXM=?= (18/23) Oct 10 2018 mapNode[6]* can be read right-to-left as 'a pointer to an array
- Codifies (3/4) Oct 10 2018 right... hence the failed attempt at an array copy... now I
I'm not sure I understand what mapNode[6]* means! (the second version is what I wanted an array of 6 pointers) oddly when assigning a null to one element of the array it cause an error as it was trying to do an array copy... so what's going on and what does that definition actually mean ?
Oct 10 2018
On Wednesday, 10 October 2018 at 13:24:42 UTC, Codifies wrote:I'm not sure I understand what mapNode[6]* means! (the second version is what I wanted an array of 6 pointers) oddly when assigning a null to one element of the array it cause an error as it was trying to do an array copy... so what's going on and what does that definition actually mean ?mapNode[6]* can be read right-to-left as 'a pointer to an array of 6 mapNodes'. For simplicity, let's use int instead of mapNode: unittest { int[6]* p; int[6] arr; p = &arr; (*p)[0] = 1; (*p)[1] = 2; (*p)[2] = 3; (*p)[3] = 4; (*p)[4] = 5; (*p)[5] = 6; assert(arr == [1,2,3,4,5,6]); } -- Simen
Oct 10 2018
On Wednesday, 10 October 2018 at 13:36:20 UTC, Simen Kjærås wrote:mapNode[6]* can be read right-to-left as 'a pointer to an arrayright... hence the failed attempt at an array copy... now I understand...
Oct 10 2018