常用数据类型 位数

注:编译运行环境 gcc 、64 bit linux

总结:

unsigned char

 8 bit 0-255   CV_8U
char   8 bit -128-127
unsigned short 16 bit 0-65535  CV_16U
short  16 bit -32768-32767 (0-2^15-1)
int  32 bit  
long 64 bit  
float 32 bit CV_32F
double 32bit CV_64F
int main()
{
  unsigned char a=256;
  char b=128;
  unsigned short c=65536;
  short d=65536/2;
  int e=5;
  long f=4;
  long int g=4;
  long long  h=4;
  float i=2.3434;
  double j=2.32424;
  
  printf("unsigned char is %d byte\t%d\n",sizeof(a),a);
  printf("char is %d byte\t%d\n",sizeof(b),b);
  printf("unsigned short is %d byte\t%d\n",sizeof(c),c);
  printf("short is %d byte\t%d\n",sizeof(d),d);
  printf("int is %d byte\n ",sizeof(e));
  printf("long is %d byte\n",sizeof(f));
  printf("long int is %d byte\n",sizeof(g));
  printf("long long  is %d byte\n",sizeof(h));
  printf("float is %d \n",sizeof(i));
  printf("double is %d \n",sizeof(j));
  
  return 0;
}

猜你喜欢

转载自blog.csdn.net/haha074/article/details/82422560
今日推荐