Terminating a C loop when maximum hardware limit reached
Use unsigned rather than signed because once there is overflow the effect is undefined.
Whereas with unsigned there is no overflow but modulo arithmetic plus it produces an additional value. 

cat &gt;fib2.c &lt;&lt;EOF
// Fibinocci numbers
#include &lt;stdio.h&gt;
int main(){
   for (unsigned long long ii=1, fib=1, prev=0, temp;
         fib&gt;=prev;  // Wrap indicates max value per implementation
         ii++, temp=fib, fib+=prev, prev=temp)
      printf("%llu: %llu\n", ii, fib);
   }
EOF
gcc -std=c99 -ofib2 fib2.c
./fib2