answersLogoWhite

0


Best Answer

Da program pa yakho obo olambawa

User Avatar

Wiki User

15y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Suppose AX and BX contains signed numbers write some code to put the bigger one in CX and if they are equal add them in AX?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Why do you need signed and unsigned integer?

We need signed integers in order to represent both negative and positive values. However, some numbers can never be negative. For instance, the size of a file must always be greater than or equal to zero so we use unsigned integers to represent file sizes. Also, natural numbers must be greater than 0 so there's no point in using a signed value to represent a natural number. Signed integers also use one bit to denote the sign, but unsigned integers do not thus unsigned integers can effectively represent twice the range of positive values than an unsigned integer can. For instance, an 8-bit signed value can represent values in the range -128 to +127 using twos complement notation, but an 8-bit signed value can represent values in the range 0 to 255.


What is the difference between signed charcter and unsigned character in c?

In terms of storage there is no difference. A signed int is the same length (in bits) as an unsigned int. The only difference is the range of values that can be represented by those bits. With signed integers, the most-significant bit is used to denote the sign (0 = positive, 1 = negative), so an 8-bit signed char really only has 7-bits to store the value, thus limiting its positive range to [0:127] whereas the unsigned equivalent has the full 8-bits at its disposal so can represent values in the range [0:255]. Another difference is the way in which negative values are physically represented. There are in fact two ways of achieving this depending on the hardware. Older hardware generally uses ones-complement notation, which simply switches every bit. Thus 00101010 (+42) becomes 11010101 (-42). However, since the value zero is neither positive nor negative, we end up with two representations for the value zero (00000000 and 11111111). This also limits the range to [-127:127] for 8-bit signed values. Newer hardware uses twos-complement notation. To switch the sign, we first take the ones-complement as before but we then add 1 and ignore any overflow. Thus 00000000 becomes 11111111 + 1 which is 00000000. This, in turn, increases the negative range by 1, such that an 8-bit signed char now has a range of [-128:127]. Generally speaking, we use unsigned integers whenever we need to represent natural numbers, such as file sizes or array sizes; values that can never be negative. For all other work, we use signed integers. Note that in C++ a plain char may be signed or unsigned (depending on the implementation), but is not considered the same type as either a signed or unsigned char. They are three completely independent types. Thus a plain char is only guaranteed to represent values in the range [0:127], the ASCII character codes; the only values common to both signed and unsigned char. If you specifically need to represent values outwith this range, such as [-128:127] or [0:255], use an explicitly signed or unsigned char respectively. All other integer types (short, int, long and long long) are implicitly signed unless you explicitly declare them with the unsigned modifier. Note also that floats, doubles and long doubles are always signed (they cannot be modified).


Meaning of signed integer in c language?

signed integer means that it has a sigh (+ or -). Using another words you say that signed variable can be positive as well as negative. unsigned variables can be only positive.


What are the four integral types in C plus plus?

There are far more than 4 integral types in C++. As of C++11, there were 27 integral types: bool char signed char unsigned char wchar_t char16_t char32_t short signed short unsigned short short int signed short int unsigned short int int signed int unsigned int long signed long unsigned long long int signed long int unsigned long int long long signed long long unsigned long long long long int signed long long int unsigned long long int


What does a signed data type mean?

signed: its value can be less than zero unsigned: its value cannot be less than zero example: 16 bit signed: -32768 .. 32767 16 bit unsigned: 0 .. 65535