《c专家编程》

区别1:

#define peach int

usigned peach i;  /*正确*/

 

typedef int banana;

unsigned banana i; /*错误*/

 

 

区别2:

#define int_ptr int *

int_ptr chalk, cheese;

宏扩展后相当于int * chalk,cheese;

 

typedef  int * int_ptr;

int_ptr chalk, cheese;

则表示int *chalk,*cheese;

用typedef定义的类型能够保证声明中的变量为同一类型!

相关文章:

  • 2021-11-04
  • 2022-01-04
  • 2021-09-17
  • 2021-08-16
  • 2021-09-07
  • 2021-08-06
  • 2021-07-09
猜你喜欢
  • 2022-01-13
  • 2021-05-17
  • 2022-01-16
  • 2022-03-07
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案