Ask your own question, for FREE!
Computer Science 13 Online
OpenStudy (anonymous):

what is wrong with this code. it gives a seq fault at line 26.s1[k++]=s1[i] language was c here is the code http://codepad.org/HUXARgv8

OpenStudy (e.mccormick):

Are you making sure in can't go beyond the range of the array?

OpenStudy (anonymous):

yes i think so........

OpenStudy (e.mccormick):

Because it looks like you are advancing to the end of the array inside the loop, then advancing one more.

OpenStudy (anonymous):

and where is that one more?

OpenStudy (e.mccormick):

Where you are getting the error.

OpenStudy (anonymous):

u mean with k?

OpenStudy (e.mccormick):

Ah, no... hmm.. you changed iterators.

OpenStudy (anonymous):

?

OpenStudy (e.mccormick):

I was thinking it was the same iterator. You changed from i to k.

OpenStudy (e.mccormick):

Did you try printing out the values as you go so you can see how far it gets in the sequence before it breaks?

OpenStudy (e.mccormick):

Something like this: http://codepad.org/XLSs2cPL Then you have a chance of seeing how far it is getting.

OpenStudy (anonymous):

i used gdb

OpenStudy (anonymous):

@rsmith6559

OpenStudy (anonymous):

the bug is with the declarations.i was trying to midify const literals.well thanks y'all

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!