getting sigsegv error in tangdiv

not able to detect which part is causing segmentation fault
link to my code is:

Have a look at this code. I just changed the variable “t” inside the while to “x” and it gave correct answer. You were using “t” inside the while which was the reason for SIGSEGV error because it was effecting the value of the “t” outside the while loop(which you used for the number of test cases).


Even now getting SIGSEGV (after changing t to x)

Why are you submitting it in C+11…? I submitted it in C++4.3.2.
Link :

thanks got AC finally but why it was giving segmentation fault in C++11

I tried to look for it but couldn’t figure it out. Maybe due to the while loop in the second for loop.