| Chris Vine <chris@cvine--nospam--.freeserve.co.uk>: Oct 27 06:21PM +0100 On Wed, 27 Oct 2021 19:02:46 +0200 > On 27/10/2021 18:41, Chris Vine wrote: > > On Wed, 27 Oct 2021 11:07:03 +0200 > > David Brown <david.brown@hesbynett.no> wrote: [snip] > > } > Yes, that is much the same as a reference in C++ (though you'd be > slightly closer with "char (*arr)[10]" ). You are agreeing with me: I think you understand that although I am not entirely sure. The overarching point is that in the signature: void func (char arr[10]) 'arr' is not the name of an array at all but is the name of a pointer to char. You can pass func the address of any char object, whether or not a member of an array. This is the fundamental misunderstanding by the person in question. With: void func (char (&arr)[10]) 'arr' is a reference to an char array of size 10 and only that. With: void func (char (*arr)[10]) 'arr' is a pointer to an char array of size 10 and only that. |
| You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page. To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com. |
No comments:
Post a Comment