On Feb 26, 10:27*am, Anand Hariharan
<mailto.anand.hariha...@gmail.com> wrote:
> On Jan 31, 6:56*pm, "BartC" <b...@freeuk.com> wrote:
>
> > "glen herrmannsfeldt" <g...@ugcs.caltech.edu> wrote in message
>
> >news:kef22i$sr8$...
>
> > > * *A=B+C;
> > > Seems to me that you could almost do that in C, as there is no
> > > current operation defined for + between two arrays (or pointers).
>
> > No, because arrays aren't handled by value as they would need to be.
>
> Correct.
>
> > Besides, the "-" operator *is* defined between two arrays (although exactly
> > how the arrays are related is significant):
>
> IANAL, but that is incorrect. *The operands of the minus operator are
> the decayed pointer values, not the arrays.
>
> > #define n 10
> > int A[n],B[n];
> > int C;
>
> > C=A-B;
>
> > printf("%d\n",C);
>
> Again, IANAL, but that is UB. *(Your compiler might probably warn you
> about C being the wrong type, that it should be ptrdiff_t, but that is
> not a constraint violation.)
>
> - Anand
Sorry, didn't notice that 'Noob' had already addressed this in
'<512aa3c0$0$1992$>'.
- Anand
|