I am using the iterative fib algorithm that I have copied below. I have found this algorithm on Rosetta code and it gives me the correct answer up until fib(46). After that
You have to use long long also for fnow, fnext, and tempf, try:
long long
fnow, fnext, and tempf
long long int fnow = 0, fnext = 1, tempf;