Why my code is giving run error?
Code giving run error
i have asked the question yesterday still no reply. I have also switched on my collaborative mode. Please help. Anyway i am sharing my link too. https://ide.codingblocks.com/s/231149
okay i will check for errors and get back to you. The reason no one had taken your doubt was because you had not posted the code link in which the error is present.
Hi I have found the error
Change you limits in the for loop to a from 0 to n-3, b from a+1 to n-2, c from b+1 to n-1, d from c+1 to n as your current range is not able to include range if a,b,c,d are the last 4 indices.
did it but did not work. moreover i think it will not because even condition is already set that loop iterator element will always be <n. Therefore null pointer exception shall never be raised. Another i did not post the code because i have switched on the collaborative mode in my course.
is it giving runtime error on all the test cases or a specific test case?
I ran your code on testcase 2 and it is showing segmentation fault
only two locations are possible where segementation fault can occur, one which I have already told about and another is your const int limit which you have set to 138. Try changing it to 69 as upon doing so the fault is resolved. 138 is too big of a limit and is going out of index for the array