You are not logged in. Please login at www.codechef.com to post your questions!

×

getting SIGSEGV error.

why i am getting SIGSEGV error for problem http://www.codechef.com/problems/LEBOMBS

here is my solution http://www.codechef.com/viewsolution/6455430

asked 10 Mar '15, 18:23

rishu97kr's gravatar image

2★rishu97kr
2528
accept rate: 0%


SIGSEGV error means that you are trying to access invalid memory reference like array element out of bound. In your solution, suppose a test case like this

1

1

0

Here the length of the string is 1. And you are trying to access s[1]. This is the cause of SIGSEGV. Check here.

Hope this clears your doubt.

Happy Coding !!!!

link

answered 11 Mar '15, 11:13

shivam217's gravatar image

4★shivam217
8383515
accept rate: 20%

edited 11 Mar '15, 11:15

http://www.codechef.com/viewsolution/6477983

i have corrected fault at all the places i could find, still giving same error. AND why this code is running fine in my code blocks compiler but giving runtime error at ideone???

(12 Mar '15, 18:03) rishu97kr2★

I think there is a problem in your input function because when I used cin , I got AC. http://www.codechef.com/viewsolution/6481747.

PS: I also got AC when I used fast i/o which I generally used. http://www.codechef.com/viewsolution/6481718

(12 Mar '15, 22:25) shivam2174★
toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×3,766
×1,912
×1,672
×1,477
×1,388
×678
×2

question asked: 10 Mar '15, 18:23

question was seen: 682 times

last updated: 12 Mar '15, 22:27