编辑代码


#include<limits.h>

#include<stdio.h>

void ranges(){

              //char-signed

              printf("signed char\n");

              printf("minimum value: %d\n",SCHAR_MIN);

              printf("maximum value: %d\n",SCHAR_MAX);

             

              //char-unsigned

              printf("\nunsigned char\n");

              printf("minimum value: %d\n",0);

              printf("maximum value: %d\n",UCHAR_MAX);

             

              //short-signed

              printf("\nsigned short\n");

              printf("minimum value: %d\n",SHRT_MIN);

              printf("maximum value: %d\n",SHRT_MAX);

             

              //short-unsigned

              printf("\nunsigned short\n");

              printf("minimum value: %d\n",0);

              printf("maximum value: %d\n",USHRT_MAX);

             

              //int-signed

              printf("\nsigned int\n");

              printf("minimum value: %d\n",INT_MIN);

              printf("maximum value: %d\n",INT_MAX);

             

              //int-unsigned

              printf("\nunsigned int\n");

              printf("minimum value: %d\n",0);

              printf("maximum value: %u\n",UINT_MAX);

             

              //long-signed

              printf("\nsigned long\n");

              printf("minimum value: %ld\n",LONG_MIN);

              printf("maximum value: %ld\n",LONG_MAX);

             

              //long-unsigned

              printf("\nunsigned long\n");

              printf("minimum value: %lu\n",0l);

              printf("maximum value: %lu\n",ULONG_MAX);

             

              //long long-signed

              printf("\nsigned long long\n");

              printf("minimum value: %lld\n",LLONG_MIN);

              printf("maximum value: %lld\n",LLONG_MAX);

             

              //long long-unsigned

              printf("\nunsigned long long\n");

              printf("minimum value: %llu\n",0ll);

              printf("maximum value: %llu\n",ULLONG_MAX);
}

int main(){

              ranges();

              return 0;

}