C不同变量类型存储大小引发的BUG
#include"stdio.h"
typedef signed char int8;
typedef unsigned char uint8;
typedef signed short int int16;
typedef unsigned short int uint16;
typedef signed long int int32 ;
typedef unsigned long int uint32;
int main()
{
int8 num8 =0;
int16 num16 =0;
int32 num32 =0;
int32 numb32 =0;
int16 numb16 =0;
int8 numb8 =0;
printf("input a number16 :\n");
scanf("%d",&num16);
printf("input a number8: \n");
scanf("%d",&num8);
printf("input a number32: \n");
scanf("%d",&num32);
printf("num16: %d \t num8: %d\t num32: %d \n",num16,num8,num32);
printf("------------------------------------------------------\n");
printf("input a number16 :\n");
scanf("%d",&numb16);
printf("input a number8: \n");
scanf("%d",&numb8);
printf("input a number32: \n");
scanf("%d",&numb32);
printf("numb16: %d \t numb8: %d\t numb32: %d \n",numb16,numb8,numb32);
getchar();
printf("\a");
}
转载请注明出处。https://www.cnblogs.com/jyfootprint/p/9457346.html