1

I was reading a C++ text and while I was solving some questions, I came across this question :-

An easy way to know the largest unsigned int on a computer with two's complement is :

unsigned int largeui = -1;

Test if it does and explain why?

I tried it out, and the output was :

4294967295

So, finally my question. Why is the value that and why does :

unsigned int largeui = -1;

work? Please clarify why -1 ?

Ankit Panda
  • 198
  • 1
  • 17

0 Answers0