Monitored command dumped core (in a C program) - no code at referenced line | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Monitored command dumped core (in a C program) - no code at referenced line

https://code.sololearn.com/cvzL2Vv9qsPH/?ref=app I get the above error and it references a line with no code in it. I’ve read other posts about this error but they weren’t helpful as there’s no line of code to troubleshoot. This is a merge sort algorithm, however so memory is used for temporary arrays. Is that the issue? I’m mot sure where to go from Here. Any help is appreciated. Thank you!

19th May 2020, 2:10 PM
Ian Andersen
Ian Andersen - avatar
5 Answers
+ 2
This error occurs when you try to access to an address that you dont have access to. Might be because of trying to access non existing array elements.
19th May 2020, 2:18 PM
Mustafa K.
Mustafa K. - avatar
+ 2
Bugs fixed: • m = r + (l-1)/2 will evaluate l/2 first as '/' has higher precision. Therefore, I corrected it to (r+l)/2. Note that (l-1) isn't required because 'l' itself represents the index • you missed a y++ at line 46 • added a loop to print the array https://code.sololearn.com/cV51dFlvf9o7/?ref=app
19th May 2020, 2:22 PM
Infinity
Infinity - avatar
+ 2
Thanks you Infinity! C has been a challenge for me in the area of memory and not clearly coded errors but I suppose thats why its good to learn it. is it common in C for math syntax issues to error out in a memory code?
19th May 2020, 3:21 PM
Ian Andersen
Ian Andersen - avatar
+ 2
Thank you as well Mustafa. I suspected memory issues but its good to have it confirmed. Pointers still make my head hurt. ill get there!
19th May 2020, 3:22 PM
Ian Andersen
Ian Andersen - avatar
+ 1
Hi Ian, you're welcome Yes, it's common for math errors to cause segmentation faults, because you can't really "see" the index values when they're stored in variables unless you trace them out. Please reach out to me in future as well. I'd be happy to help you out to the best I can 😊 Thank you! Happy coding!
19th May 2020, 3:36 PM
Infinity
Infinity - avatar