3 ms·
Pointer decay is not a mistake. It is what allows to do int * p = arr, and looping on array element with p++. Keeping array type you would jump beyond the las
by xeyownt 2y ago
Pointer decay is not a mistake.
It is what allows to do int * p = arr, and looping on array element with p++.
Keeping array type you would jump beyond the last element at first iteration.
- kaba0 2y agoIt is, an array and a pointer are different types. There could be ways to convert it to a pointer, but it shouldn’t happen at so many places, implicitly.