getting sigsegv error in tangdiv

not able to detect which part is causing segmentation fault
link to my code is:
http://www.codechef.com/viewsolution/3792043

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).

2 Likes

Even now getting SIGSEGV (after changing t to x)
link: CodeChef: Practical coding for everyone
@roman28

Why are you submitting it in C+11…? I submitted it in C++4.3.2.
Link : CodeChef: Practical coding for everyone

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.