What is a difference between unsigned int and signed int in C?
belongs to collection: C interview questions, your interviewer might ask
All Answers
total answers (1)
belongs to collection: C interview questions, your interviewer might ask
total answers (1)
Answer:
The signed and unsigned integer type has the same storage (according to the standard at least 16 bits) and alignment but still, there is a lot of difference them, in bellows lines, I am describing some difference between the signed and unsigned integer.
For example,
Assuming the size of the integer is 2 bytes.
signed int -32768 to +32767
unsigned int 0 to 65535
For example,
Computational Result % (Largest value of the unsigned integer+1)