Why is tis code giving SIGSEGV error although no array element is out of bounds?Plz help I am new to competitive coding.

It is from beginner practice questions(TRACE).

Suppose n=100

So when you are calculating maximum trace at last iteration i=99 and k=98

Now i+k=197 which does not exist and thus the runtime error.