0

Palindrome problem

If I run the code as written it works fine with word in main function defined up front. If I try and change the main function to accept input with fgets or scanf I get core dump error. Can anyone tell me why? https://code.sololearn.com/cOhpw23t893N/?ref=app

20th Jan 2020, 8:13 PM
Shay Christensen
Shay Christensen - avatar
6 RĂ©ponses
+ 3
Remove the orgc size 25. like just orig[] then try... orgc[25]={r,a,s,e,s,a,r}; Then strlen(orig) will return 25 not 7. Then orig[origlength - (i+1)] =>orig[25] =>fatal error...
20th Jan 2020, 9:10 PM
Jayakrishna 🇼🇳
+ 1
Thanks a million devanville!
21st Jan 2020, 12:39 AM
Shay Christensen
Shay Christensen - avatar
0
Thank you to both! I think either way i had to initialize j but also didnt know i could pass a string into function with empty [].
20th Jan 2020, 10:06 PM
Shay Christensen
Shay Christensen - avatar