4 ms·
> I meant that “abc” + “def” is most likely illegal That would be adding 2 pointers, and that's indeed illegal. However, you can subtract them: “abc” - “def”
by wott 5y ago
> I meant that “abc” + “def” is most likely illegal
That would be adding 2 pointers, and that's indeed illegal.
However, you can subtract them: “abc” - “def” . Now, the result is not a pointer any more, it's a ptrdiff_t (an integer type), so most compilers will warn if you try to assign that to a char *.