0
Warning show up
Could any one example me why this warning show up. ( size_type' (aka 'unsigned long') to 'int' )
1 Answer
+ 1
Because you eventually loose information when casting from unsigned long to int.
Here I set an unsigned long int to the maximum value an integer can store and increased it by 1.
the unsigned long can hold it, but the 0s and 1s in the memory aren't the same for these both data types. When casting this value to int you'll get an overflow
and the value is now at the min value an int can hold.
https://code.sololearn.com/cyen1RDIZKM4/?ref=app