I am working on a program which generates a segmentation fault and I cannot understand why. If I remove the pointer declaration from "lowest" and "largest" variables and use them as pointerless integers the program works fine.

However, as soon as I try to use pointers, problems arise and I receive a segmentation fault. I realize that this is probably a very easy and well addressed issue, but I've tried to understand the code by looking on other similar problems. I haven't found a solution for my problem yet. Nor do I understand what's going wrong.

This is the code generating the problem (link to full source is below):

It doesn't work, because it doesn't compare pointers. You are comparing the values stored at some memory addresses, which most likely don't belong to your program, therefore you are shot down by a SIGSEGV.