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

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -