title: Comparing two equal unsigned long in C evaluates to false
body: <p>I am new to C and playing around with it. So I ended up in implementing the fibonacci code (iterative and recursive). I wrote a test function which should give me a green (my implementation works) or red. It says that I get the right return value but it's state is red. The two values should be both unsigned long. I am compiling on OSX with make</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  unsigned long fibonacci(unsigned long n);
  void test_fibonacci(unsigned long n, unsigned long assertion);
  
  int main(int argc, char* argv[])
  {
      test_fibonacci(1, 1);
      test_fibonacci(2, 1);
      test_fibonacci(3, 2);
      test_fibonacci(10, 55);
      return 0;
  }
  
  unsigned long fibonacci(unsigned long n)
  {
      unsigned long result = 1;
      unsigned long lastResult;
      for (unsigned long i = 2; i &lt;= n; i++)
      {
          // save the current result to save it as the lastResult after this iteration
          unsigned long lastResultTmp = result;
          result = lastResult + result;
          lastResult = lastResultTmp;
      }
      return result;
  }
  
  void test_fibonacci(unsigned long n, unsigned long assertion)
  {
      printf(
          "fibonacci(%lu): %lu    | %s | asserted: %lu\n",
          n,
          fibonacci(n),
          (fibonacci(n) == assertion) ? "green" : "red",
          assertion
      );
  }
  </code></pre>
  
  <p>My Makefile</p>
  
  <pre><code>CFLAGS=-Wall -g
  
  all: main
  
  clean:
      rm -f main
      rm -Rf *.dSYM
  </code></pre>
  
  <p>Output: </p>
  
  <pre><code>fibonacci(1): 1    | green | asserted: 1
  fibonacci(2): 1    | red | asserted: 1
  fibonacci(3): 2    | red | asserted: 2
  fibonacci(10): 55    | red | asserted: 55
  </code></pre>