0

Whenever I try to get the encryption it shows floating point exception (core dumped). According to some Google links this error comes when dividing by 0 but in my code that is not the case. The only thing that I suspect is at a certain place I am using a modulo function j % strlen(k) where j is initialized to 0.

5
  • 1
    And what about strlen(k)? What is k - could it have a length of zero? Try printing it out before the modulo line. – Air Sep 5 '14 at 23:18
  • @AirThomas no the length can't be zero – pranav Sep 6 '14 at 7:59
  • is 0 % something not allowed? – pranav Sep 6 '14 at 8:50
  • 0%something is fine. It's when you divide by 0 that you'll get that error. Are you sure you aren't using modulo somewhere else? – curiouskiwi Sep 8 '14 at 5:04
  • @curiouskiwi got my answer actually i had saved strlen(k) in another variable earlier so that's why there was an error.. – pranav Sep 8 '14 at 14:04

You must log in to answer this question.

Browse other questions tagged .