When I run this code on my Windows machine, it works fine.
When I ssh into a redhat linux machine to run the code, it returns a segmentation fault.
Commit this to memory. Tattoo it on the inside of your eyelids: Programs work by accident.
In your case, the redhat version is crashing because the code is buggy. The Windows version works entirely by accident. It's a happy coincidence that it doesn't crash on windows.
Whenever a program works in one environment and doesn't in another, the problem is usually a bug, not a problem with the one environment.
the worst thing that can happen is when code with a massive flaw appears to work correctly.
in the basic case of buffer overruns, for example ...
say you have an array variable followed by an integer. If you overflow the array, the integer changes value, probably to something valid but incorrect that may be hard to see when testing that it was incorrect. Everything works fine, sort of, except you have a corrupt value -- if that value is not used for anything that crashes or vital data that the tester will note the bad data, all appears well.... and then your customers have bad data for years until someone notices it and they realize they all owe the IRS another billion bucks and its YOUR fault :)