首页> 中文期刊> 《现代电子技术》 >C语言函数参数传递规律

C语言函数参数传递规律

         

摘要

C语言的模块设计主要是通过函数实现的,函数间信息的传递主要是通过参数实现的.函数的参数传递包括传值和传址.为了区别两种传递方式的不同,采用实例和图示两种方法,列举了变量、数组名、指针作参数的实例,通过比较函数调用后形参和实参的变化,总结出函数调用时参数传递的两种规律,即基类型变量、数组元素、结构体变量作参数时是传值,也就是单向的值传递;数组名、指针作参数时是传址,也就是共享同一个地址.%C language module design is implemented mainly through the function. The information between the functions is delivered by parameters. The parameter delivery of the function includes the delivery value and delivery address. In order to distinguish the difference of the two modes, two methods of examples and illustrations are adopted. The instances which takes variable, array name and pointer as parameters are listed. By comparing the variation of formal parameter and actual parameter after function call, two laws of the parameter delivery, while the function was called, were summed up: the base type variable, array element and structure variables as parameters are passed by value, that is, they deliver information in one ways the array name and pointer as parameters are passed by address, that is, they share the same address.

著录项

相似文献

  • 中文文献
  • 外文文献
  • 专利
获取原文

客服邮箱:kefu@zhangqiaokeyan.com

京公网安备:11010802029741号 ICP备案号:京ICP备15016152号-6 六维联合信息科技 (北京) 有限公司©版权所有
  • 客服微信

  • 服务号