Home > Back-end >  On the C language
On the C language

Time:12-06

. Write a program to find out your machine unsigned int, can store the data type of the largest integer and the largest integer bit digits, and print them out, how to do? Head.

CodePudding user response:

Largest integer: 0 can be as a complementation,
Bit: after the sizeof by 8

CodePudding user response:

reference 1st floor liups response:
: the largest integer can be 0 as a complementation,
Bit: after the sizeof by 8

CodePudding user response:

 # include & lt; Stdio. H> 

Int main (int arg c, char * const argv [])
{
Unsigned int x=1;
Size_t I=1;
For (;; + + I)
{
X & lt; <=1;
If (x==0) break;
}
Printf (" unsigned int have % ld bits \ n ", I);
Printf (" unsigned int have % ld bits \ n ", sizeof (x) * 8);
Printf (" maximum unsigned int value is % u \ n ", ~ (unsigned int) 0);
Printf (" maximum unsigned int value is x % \ n ", ~ (unsigned int) 0);
return 0;
}


Upstairs, you are right
  • Related