<% dim ModuleName,InfoID,ChannelShortName,CorrelativeArticle,InstallDir,ChannelDir,Keyword,PageTitle,ArticleIntro,Articlecontent Keyword=stripHTML("C语言,查看,各种,数据,类型,size") PageTitle=stripHTML("C语言查看各种数据类型的size") ArticleIntro=stripHTML("c语言查看更多的类型") Articlecontent=stripHTML("C语言查看各种数据类型的size  intptr_t 定义在/usr/include/stdint.h,  #if __WORDSIZE == 64  # if…") ModuleName = stripHTML("programme") InfoID = stripHTML("221449") ChannelShortName=stripHTML("编程") InstallDir=stripHTML("http://www.77169.com/") ChannelDir=stripHTML("programme") %> C语言查看各种数据类型的size - 华盟网 - http://www.77169.com
您现在的位置: 华盟网 >> 编程 >> C语言 >> 正文


2016/1/13 作者:Linux 来源: Linux社区
导读 <% if len(ArticleIntro)<3 then Response.Write Articlecontent 'Response.Write "Articlecontent" else Response.Write ArticleIntro 'Response.Write "ArticleIntro" end if %>


  intptr_t 定义在/usr/include/stdint.h,

  #if __WORDSIZE == 64

  # ifndef __intptr_t_defined

  typedef long int intptr_t;

  # define __intptr_t_defined

  # endif

  typedef unsigned long int uintptr_t;


  # ifndef __intptr_t_defined

  typedef int intptr_t;

  # define __intptr_t_defined

  # endif

  typedef unsigned int uintptr_t;




  int main(void)


  int *ptr;

  printf("sizeof int is %d\n",sizeof(int));

  printf("sizeof char is %d\n",sizeof(char));

  printf("sizeof short is %d\n",sizeof(short));

  printf("sizeof long is %d\n",sizeof(long));

  printf("sizeof float is %d\n",sizeof(float));

  printf("sizeof double is %d\n",sizeof(double));

  printf("sizeof pointer is %d\n",sizeof(ptr));

  printf("sizeof unsiged int is %d\n",sizeof(unsigned int));

  //store pointers in integer type,use size_t,INT_PTR,intptr_t;

  printf("sizeof size_t is %d\n",sizeof(size_t));

  //intptr_t defines in stdint.h

  printf("sizeof intptr_t is %d\n",sizeof(intptr_t));

  //INT_PTR only exist in windows

  //printf("sizeof INT_PTR is %d\n",sizeof(INT_PTR));


  查看各种数据类型的MAX 和MIN 值




  int main()


  printf("The value of INT_MAX is %i\n", INT_MAX);

  printf("The value of INT_MIN is %i\n", INT_MIN);

  printf("An int takes %d bytes\n", sizeof(int));

  printf("The value of FLT_MAX is %f\n", FLT_MAX);

  printf("The value of FLT_MIN is %.50f\n", FLT_MIN);

  printf("A float takes %d bytes\n", sizeof(float));

  printf("The value of CHAR_MAX is %d\n", CHAR_MAX);

  printf("The value of CHAR_MIN is %d\n", CHAR_MIN);

  printf("A CHAR takes %d bytes\n", sizeof(char));

  printf("The value of DBL_MAX is %f\n", DBL_MAX);

  printf("The value of DBL_MIN is %.50f\n", DBL_MIN);

  printf("A double takes %d bytes\n", sizeof(double));

  printf("The value of SHRT_MAX is %d\n", SHRT_MAX);

  printf("The value of SHRT_MIN is %d\n", SHRT_MIN);

  printf("A short takes %d bytes\n", sizeof(short));

  printf("The value of LONG_MAX is %Ld\n", LONG_MAX);

  printf("The value of LONG_MIN is %Ld\n", LONG_MIN);

  printf("A long takes %d bytes\n", sizeof(long));

  return 0;


  在stdint.h 里面定义了很多int*_t 和uint*_t 类型。




  int main(int argc, char *argv[])


  printf("CHAR_BIT is %d\n\n",CHAR_BIT);

  printf("sizeof(char) is %d\n",sizeof(char));

  printf("sizeof(short) is %d\n",sizeof(short));

  printf("sizeof(int) is %d\n",sizeof(int));

  printf("sizeof(long) is %d\n",sizeof(long));

  printf("sizeof(long long) is %d\n\n",sizeof(long long));

  printf("sizeof(int8_t) is %d\n",sizeof(int8_t));

  printf("sizeof(int16_t) is %d\n",sizeof(int16_t));

  printf("sizeof(int32_t) is %d\n",sizeof(int32_t));

  printf("sizeof(int64_t) is %d\n\n",sizeof(int64_t));

  printf("sizeof(uint8_t) is %d\n",sizeof(uint8_t));

  printf("sizeof(uint16_t) is %d\n",sizeof(uint16_t));

  printf("sizeof(uint32_t) is %d\n",sizeof(uint32_t));

  printf("sizeof(uint64_t) is %d\n",sizeof(uint64_t));

  char a,b;

  printf("sizeof(a+b) is %d\n",sizeof(a+b));


  • 上一篇编程:

  • 下一篇编程: 没有了