+ 6
The basic idea is that -1 is not in the range of unsigned long and therefore a conversion is needed, producing the value code 1 printed. In code 2 you convert the value converted to unsigned long back to int (2 conversions, one in initialization and the other in printf()), resulting the same value -1.
+ 2
%d = Signed Integer
%lu = Unsigned integer
source: https://codeforwin.org/2015/05/list-of-all-format-specifiers-in-c-programming.html
0
unsigned integers are nonnegative. assigning a negative to an unsigned variable causes undefined behavior
Prince if you knew that, why ask?



