c - When uses unsigned data type? -


this question has answer here:

when need use unsigned data type , when signed data type in c? , want know why , how decide 1 need.

use signed data types when need variable hold negative values. careful overflows, signed integer overflows result in undefined behavior.

use unsigned data types when know variable holds non-negative values, or bit patterns. generally, can hold higher maximum value signed data type of equal size. unsigned integer overflows wraparound.


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -