+ 3

unsigned int

What happens when I use unsigned int a and make it to negative?Does it stop at 0 or what? F.x. Int a=5; Int b=7; Unsigned int sum; Sum=a-b

18th Jan 2017, 4:02 PM
Someone
3 Respostas
+ 5
You cannot assign a negative value to an unsigned int. Here is an example M means the maximum number of unsigned int unsigned int n = 0-5; cout << n; // prints M-4 unsigned int a = 0-1; cout << a; // prints M
18th Jan 2017, 4:06 PM
Andreas K
Andreas K - avatar
0
that's completely wrong @Lokesh Why should it be impossible to assign a value to an unsigned int.
27th Jan 2017, 1:56 PM
Andreas K
Andreas K - avatar
- 1
u cannot assign values to unsigned
27th Jan 2017, 1:55 PM
LOKESH MAHAJAN
LOKESH MAHAJAN - avatar