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

C语言中指针变量的用法
引用本文:周二强,张妍琰.C语言中指针变量的用法[J].电脑与微电子技术,2014(3):41-43.
作者姓名:周二强  张妍琰
作者单位:河南城建学院计算机科学与工程学院,平顶山467036
摘    要:C语言中使用指针变量时通常需两步:第一步为指针变量赋值,把某个存储单元的地址存入与指针变量相关的存储单元中,即让指针变量指向某个存储单元;第二步以间接引用的方式使用指针变量指向的存储单元。利用变量直接使用存储单元时,存储单元的使用范围受限于变量的作用域,而通过指针变量以间接引用的方式可以扩展存储单元的使用范围。以间接引用方式使用的存储单元不仅可以是基本数据类型的、数组等,而且可以是没有变量标识的堆空间上的存储单元,甚至还可以是与代码相关的“函数类型”的存储单元。

关 键 词:指针  存储单元  C语言

Usage of the Pointer Variable in C Language
Authors:ZHOU Er-qiang  ZHANG Yan-yan
Affiliation:ZHOU Er-qiang, ZHANG Yan-yan
Abstract:Uses a pointer variable in C programming language need to take two steps:the first step is to assign the pointer variable a value, stores the address of the storage unit into place that is associated with the pointer variable, makes the pointer variable pointing to a storage unit; the second step is to use the storage unit which is pointed by the pointer variable in an indirect way. When uses a storage unit directly by the variable, the range of the storage unit is limited by the scope of the variable. By contrast,it can extend the range of the storage unit by using a pointer variable in the indirect way. The storage unit used in an indirect way can not only be the basic types or arrays, but also can be the storage unit that is not signed as a variable on the heap space, even can be the function type storage unit that is related to the code.
Keywords:Pointer  Storage Unit  C Language
本文献已被 维普 等数据库收录!
设为首页 | 免责声明 | 关于勤云 | 加入收藏

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