Computational verification of Collatz conjecture using gmplib
If you need a type with exactly 64 bits, use uint64_t (from &lt;stdint.h&gt;).  That will give a clear compilation error if no such type is available.

Given that the function never returns anything other than zero, we can move the cleanup of n, n0 and n_max outside the loop, and simply break to reach them.

Is indefinite looping really a good output if a cycle is detected?  How is that distinguishable from an arbitrarily long (but finite) chain?  Look up the standard algorithms for cycle detection in your graph theory textbook.