3 ms·
You did not use arrays, so there were no bounds to be checked. The C language indeed allows the use of pointers having arbitrary values that cannot be checked
by adrian_b 2y ago
You did not use arrays, so there were no bounds to be checked.
The C language indeed allows the use of pointers having arbitrary values that cannot be checked in any way.
However it is trivial to avoid the use of such pointers and any decent programmer will never use such pointers, because they are never needed.
Unfortunately, it is difficult to forbid the use of such pointers, because there are too many legacy programs.
That however cannot be an excuse for any programmer who is writing a new program. If someone uses pointers in such a way, that cannot happen through an unwilling mistake, so it is their fault and they have no right to blame the programming language.
- saagarjha 2y agoNew programs are unfortunately bound to old APIs. There's not much you can do here to fix the problem.