基本语句和运算

逗号运算符和逗号表达式:整个逗号表达式的值是最后一个表达式的值。


  int a = 2;
  int b = 0;
  int c;
  int d;
  c = (++a,a *= 2,b = a * 5);
  printf("c = %d",c); //输出:c = 30
  d = ++a,a *= 2,b = a * 5;
  printf("d = %d",d); //输出:d = 3


sizeof:可以用来计算一个变量或者一个常量、一种数据类型所占的内存字节数。


  int size = sizeof(10);
  printf("10所占的字节数:%d",size); //输出结果:10所占的字节数:4

  sizeof(10); //(常量)
  sizeof 10; //常量
  sizeof(c); //(变量)
  sizeof c; //变量
  sizeof(float); //(数据类型)
  不可以写成:sizeof float;

原文地址:https://www.cnblogs.com/tzktzk1/p/3329432.html