Unsigned datatype

P

prashant.khade1623

Hi

When do we use unsigned data type. And what are the adantages of using
Unsigned.
 
P

Peter Nilsson

When do we use unsigned data type.

When dealing with non-negative integers, e.g. object
sizes (size_t), and particularly when performing bitwise
manipulations.
And what are the adantages of using Unsigned.

Bure binary representation and modulo arithmetic.
 
N

Nick Keighley

(e-mail address removed) wrote:

When dealing with non-negative integers, e.g. object
sizes (size_t), and particularly when performing bitwise
manipulations.

ie. >> << | & ^ ~

Bure binary representation and modulo arithmetic.

unsigned values don't overflow they simply wrap around.

unsigned u = 0;
u -= 1;

u now holds the largest possible unsigned int.
 
W

Walter Roberson

When do we use unsigned data type.

Any day -except- the second Thursday or fifth Friday of the month.
The second Thursday is kept in memory of the death of George Boole
(Thursday Dec 8 1864); and the fifth Friday is when the
Regional Alamgamated Philisophers And Programmers hold their
meetings in pubs everywhere.
And what are the adantages of using
Unsigned.

It's like a membership badge; if you don't know how to use unsigned
arithmetic then you don't get told where the next RAPAP meeting is.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top