when do you use a unsigned integer. Is there a appropriate case? Thanks
Printable View
when do you use a unsigned integer. Is there a appropriate case? Thanks
Well. Not any special cases. It depends of the variable.
If you are sure that the variable will never have to hold a negative value but only positive values then use an unsigned variable (integer).
Unsigned integers can only hold positive values.
Unsigned anything can only hold positive values.
You would also use it when you need a bigger number. For example, the long datatype can only go up to approx. 2 billion, but when unsigned, it can go up to 4 billion.
It is also used alot in APIs and DLLS.
thanks for the responces!