What is the difference between signed and unsigned int? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is the difference between signed and unsigned int?

21st Sep 2019, 3:52 PM
Ramyashri
Ramyashri - avatar
3 Answers
+ 6
They are both 32bits. But unsigned variable can store a value two times larger then signed variable. In signed integer, only 31 bits are used to the value itself. One bit terminates if the value is - or +. So all together its 32 bits. With unsigned integer, all 32 bits are used to the value. And therefore we can't have negative numbers but we can have two times larger positive value signed integer = -2,147,483,648 to 2,147,483,647 unsigned integer = 0 to 4,294,967,295
21st Sep 2019, 4:20 PM
Toni Isotalo
Toni Isotalo - avatar
0
Topper will know😉Ramyashri
22nd Sep 2019, 7:19 AM
Diya Sujith
0
🙄🙄🙄
23rd Sep 2019, 12:23 AM
Ramyashri
Ramyashri - avatar