There are two places in the code where you use
min - max
and in both places it should be
max - min
2
solved C segmentation fault for no reason
 
There are two places in the code where you use
min - max
and in both places it should be
max - min
2
solved C segmentation fault for no reason