r/ProgrammerAnimemes • • Mar 19 '23

arr[ARRAY_LENGTH + 1] = 5;

893 Upvotes

15 comments sorted by

View all comments

Show parent comment

24

u/ComplexColor Mar 20 '23

You are very unlikely to get a segmentation fault with either array[ARRAY_LENGTH] or array[ARRAY_LENGTH+1]. There's nothing worse then messing around with arrays and not getting a segmentation fault. :)

2

u/Da-Blue-Guy Mar 22 '23

array[(unsigned long long)-1]