#define PINT int * 与 typedef int * SINT;

#define 
 宏命令,在编译前,由预处理器做替代,如同文本编辑的替代命令,把程序中的所有遇到的词,全部替代


例如:
#define PINT int* 
就是把所有的词 PINT 替换成 int * ,替换完毕再编译。 int* x; 和pint x; 的声明是等价


typedef 
类型重命名,可以把一切合法的变量都定义为类型


例如:
typedef int* sint; 
是语句,由编译器在编译过程中编译处理。


#include<stdio.h>
#define PINT int*
typedef int *SINT;

void main()
{
PINT a, b;  / /a 为int*,b为int.
SINT x, y;  / /x 为int*,y为int*.
}


#define PINT int *
typedef int *SINT;//
SINT 是类型


const SINT a,b;
const PINT x,y;

a为const int* a  
b为const int* b
x为const int* x 
y为const int y


SINT const a,b;
PINT const x,y;

a为const int* a  
b为 const int* b
x为 int * const x 
y为 int const y






  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值