首页 | 本学科首页   官方微博 | 高级检索  
     

C语言宏展开程序及其在教学中的应用
引用本文:吴斌.C语言宏展开程序及其在教学中的应用[J].常州信息职业技术学院学报,2004,3(2):37-39.
作者姓名:吴斌
作者单位:常州信息职业技术学院计算机科学与技术系,江苏,常州,213164
摘    要:常用于定义符号常量的C语言宏使程序清晰、易读,便于修改;可代替简单函数的C语言带参数宏,比函数调用具有更高的时间效率。宏使用时容易出错且不容易发现,其根本原因是编译器不提供宏展开后的代码,这给编程和教学带来了许多不便。笔者编制了一个实用的宏展开程序对源程序中的宏进行分析、处理,将源程序中的宏调用展开,产生宏展开后的源代码。根据展开的代码可以容易地发现宏使用中的问题,学生也更容易掌握宏的使用。

关 键 词:C语言  宏展开程序  预处理  
文章编号:1672-2434(2004)02-0037-03
修稿时间:2004年4月5日

C Language Macro Expansion Program and Its Application in Teaching
WU Bin.C Language Macro Expansion Program and Its Application in Teaching[J].Journal of Changzhou Vocational College of Information Technology,2004,3(2):37-39.
Authors:WU Bin
Abstract:The C language macro,which is often used in defining the symbolic constants makes the programs clear,easy to read and convenient to change. The C language macro with parameters,which can replace the simple functions,is more efficient in time-spending than the function call. When it is used,macro is apt to break down and it is difficult to find the causes. The reason is that compiler doesn't provide macro expansion codes,which brings inconvenience to programming and teaching. This paper gives a practical macro expansion program,which can analyze and process the macro in the source program and expand the macro call in the source program and produce the source codes after macro expansion. According to the expansion codes,we can easily find the problems in using macro,and the students can grasp macro more easily.
Keywords:C language  preprocess  macro  macro expansion  
本文献已被 CNKI 维普 万方数据 等数据库收录!
设为首页 | 免责声明 | 关于勤云 | 加入收藏

Copyright©北京勤云科技发展有限公司  京ICP备09084417号