Signed and unsigned integers

From cppreference.com
< c‎ | language

When a value with integer type is converted to another integer type other than _Bool, if the value can be represented by the new type, it is unchanged.

Otherwise, if the new type is unsigned, the value is converted by repeatedly adding or subtracting one more than the maximum value that can be represented in the new type until the value is in the range of the new type.

Otherwise, the new type is signed and the value cannot be represented in it; either the result is implementation-defined or an implementation-defined signal is raised.

[edit] Example

#include <stdio.h>
#include <limits.h>
 
int main(void)
{
    int a = 1L;                 /* new type can represent the value                   */
    unsigned int b = LONG_MAX;  /* new type (unsigned int) cannot represent the value */
    int c = LONG_MAX;           /* new type (signed int) cannot represent the value   */
 
    printf("%d\n", a);
    printf("%u\n", b);
    printf("%d\n", c);
 
    return 0;
}

Possible output:

1
4294967295
-1