/bin/run.sh: line 4: 19 Segmentation fault (core dumped) ./exe
im getting this output ?? what is this and why am i getting this
this is the code to sum two array of different length
/bin/run.sh: line 4: 19 Segmentation fault (core dumped) ./exe
im getting this output ?? what is this and why am i getting this
this is the code to sum two array of different length
link does not contains any code
please check the link and send the correct one
this is known as segmentation fault or runtime error
it comes when you try to access the memory which is not allocated to you
or you stuck in a infinite loop
Modified code
thank you … can I know what should one do if he gets this type of error… and why my code was giving this fault?
like what you did is , you change k to 0
and printed k from end… to get the desired result ?
so like is there any standard way to get out of these errors?
if this type of error occurs
then first dry run your code and think of corner case when your code may try to access the arr[-1] or arr[n]
this is because these memory are not allocated to you
and second thing you have to check is whether you forgot to increament i in loop or not
stuck in infinite loop or not