博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
#define 和 typedef 的区别
阅读量:2387 次
发布时间:2019-05-10

本文共 296 字,大约阅读时间需要 1 分钟。

test.c文件中包括如下语句:

#define INT_PTR int*typedef int* int_ptr;INT_PTR a,b;int_ptr c,d;

文件中定义的四个变量中,哪个变量类型不是指针类型?

正确答案: B   你的答案: B (正确)

a
b
c
d
都是指针
都不是指针

答案:B
#define INT_PTR int* 这是宏定义,编译预处理阶段要进行宏替换,INT_PTR a,b会变成 int* a,b 所以b不是指针类型
typedef int* int_ptr; 这是自定义类型,也就是把int_ptr定义为 int型指针,编译阶段会把c,d都识别为指针

转载地址:http://gwiab.baihongyu.com/

你可能感兴趣的文章
linux下载edk2链接文件
查看>>
Win10家庭版DOCKER安装(上)
查看>>
Win10家庭版DOCKER安装(下)
查看>>
docker 图形化管理工具Kitematics
查看>>
unittest单元测试框架总结
查看>>
command 'x86_64-linux-gnu-gcc' failed with exit status 1
查看>>
浅谈前端SPA(单页面应用)
查看>>
Insecure default in Elasticsearch enables remote code execution
查看>>
how to use this bugs unserialize()
查看>>
PHP5 Globals Vulnerability
查看>>
关于php包含Apache日志的随想
查看>>
Grep与web漏洞挖掘
查看>>
正则表达式使用详解
查看>>
引用函数magic_quotes_gpc和magic_quotes_runtime的区别和用法(新手推荐)
查看>>
编写不受魔术引号影响的php应用
查看>>
PHP开发安全设置
查看>>
Php Endangers - Remote Code Execution
查看>>
变量的变量,PHP和你
查看>>
PROC系列之四---/proc/loadavg
查看>>
某大型网站的内核TCP/ip优化脚本
查看>>