Assignment of Long Variables to Integers and Pointers Using int and long types in expressions and assignments can lead to implicit conversion through promotions and demotions, or explicit conversions through assignments and argument passing. Passing long arguments to functions expecting type int Exchanging pointers and int types, causing segmentation faults. Passing pointers to a function expecting an int type, resulting in truncation. Assignment of long types to float, causing possible loss of accuracy. Assigning a long constant to an integer will cause truncation without warning.
Truncation occurs because the highest bit is treated as a sign bit.
The rule here is that there will be a loss of significant digits. Similar problems occur when passing constants directly to functions, and in functions that return long types. Making explicit use of the L and UL suffix will avoid most, but not all, problems. Alternately, you can avoid accidental conversions by using explicit prototyping. Another good practice is to avoid implicit type conversion by using explicit type casting to change types.