answersLogoWhite

0


Best Answer

What is the significance of declaring a constant unsigned integer?

User Avatar

Wiki User

14y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

12y ago

the value range is different, for example:

signed char: -128..127

unsigned char: 0..255

signed short: -32768..32767

unsigned short: 0..65535

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the significance of declaring a constant unsigned integer?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is an unsigned integerWhat is significance of declaring a constant unsigned?

With a signed integer, the top bit is used to hold the sign of the number, so that the range of numbers that can be held is -(2number_of_bits-1) to 2number_of_bits-1 -1, whereas with an unsigned integer, all the bits are used to store the number which will always be positive and so the range is 0 to 2number_of_bits -1. For example, with 16 bits, a signed integer has the range -(215) to 215 -1 = -32768 to 32767 whereas an unsigned integer has the range 0 to 216 -1 = 0 to 65535. The point in particular to note is how the numbers (bit patterns) with the top bit set are interpreted: with unsigned ints they are greater than those without the top bit set (eg 0xffff = 65535 > 0x7fff = 32767), but with signed ints they are less (eg 0xffff = -1 < 0x7fff = 32767). I'm not sure about the significance of declaring a constant as unsigned (having never used one), but at a guess I would say it's to tell the compiler that the bit pattern is an unsigned bit pattern and to throw up a warning (or error) if it's used with a signed bit pattern, eg if used in a comparison with a signed int - ie an aid to cutting down on bugs by ensuring that things are only used for their intended purpose.


What is an unsigned integer?

Having an unsigned integer means that the integer is positive, and not negative; literally, the integer is unsigned and assumed to be positive. The unsigned integer 8 is positive-eight, not negative-eight.


What is the difference between signed integer and unsigned integer in terms of memory and range?

Signed integer is any integer that carries negative sign while unsigned integer is any integer that carries positive sign


Do unsigned integer variables contain negative values?

No. They are unsigned, therefore all representations are positive.


What is the difference between signed integer and unsigned integer?

An unsigned integer cannot be negative. It has a maximum positive value twice that of a signed integer. Max signed: 128 Max signed: 256 I could be off by one there, though.


What is an integer constant in c plus plus?

A constant integer is an integer that is not expected to change value while it is in scope. Declaring any variable constant doesn't guarantee it won't change, but it does make it more difficult for a programmer to change the value by accident. Constant integers must be initialised at the point of instantiation. We can initialise a constant with the value of a literal constant, the value of another constant, or the value of a variable: void f (int v) { const int x {42}; // Integer constant (initialised from literal constant) const int y {x}; // Integer constant (initialised from another constant) const int z {v}; // Integer constant (initialised from a variable) // ... v *= 2; // ok -- v is variable x *= 2; // error: x is constant }


Difference between signed and unsigned int?

A signed integer is one with either a plus or minus sign in front. That is it can be either positive or negative.An unsigned integer is assumed to be positive


What is range of 8 bit unsigned integer?

Bits administrator


Is unsigned integer constant are available in Java?

yes use the final keyword, normally variables declared final use all capital letters but this is not required final int A = 10;


How many bytes are required to store an unsigned integer range?

4


What are the permissible data types for an array index?

Integer (signed or unsigned)


Difference between signed number from unsigned number?

a signed number is one that can be negative (have a sign) whereas an unsigned number will only be positive. due to less information, you can double the largest number storable in a signed integer to get the data available in an unsigned integer. However, PHP doesn't have unsigned integers, they're all signed.