int型整数的最小值和最大值是多少
发布网友
发布时间:2023-01-02 19:46
我来回答
共1个回答
热心网友
时间:2023-10-09 22:37
void main()
{
int i=0, max, min ;
while(1) {
if(i+1<=0) {
max=i ;
min=i+1 ;
break ;
}
i++ ;
}
printf("vc下int型最大%d~~~最小%d\n",max, min) ;
}
[cpp] view plain copy
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
printf("maxInt:%d\n",INT_MAX);
printf("minInt:%d\n",INT_MIN);
system("pause");
return 0;
}
[cpp] view plain copy
#include <stdio.h>
#include <math.h>
int main()
{
int i = sizeof(int);
printf("max:%lld",(long long)pow(2,i*8-1)-1);
printf("\n");
printf("min:%lld",-(long long)pow(2,i*8-1));
}