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

C语言函数参数传递规律
引用本文:赵娟,樊超.C语言函数参数传递规律[J].现代电子技术,2012,35(4):55-56.
作者姓名:赵娟  樊超
作者单位:1. 西安工业大学北方信息工程学院,陕西西安,710025
2. 陕西青年职业学院,陕西西安,710068
摘    要:C语言的模块设计主要是通过函数实现的,函数间信息的传递主要是通过参数实现的。函数的参数传递包括传值和传址。为了区别两种传递方式的不同,采用实例和图示两种方法,列举了变量、数组名、指针作参数的实例,通过比较函数调用后形参和实参的变化,总结出函数调用时参数传递的两种规律,即基类型变量、数组元素、结构体变量作参数时是传值,也就是单向的值传递;数组名、指针作参数时是传址,也就是共享同一个地址。

关 键 词:传值  传址  C语言函数  地址共享

Parameter delivery law of C language function
ZHAO Juan , FAN Chao.Parameter delivery law of C language function[J].Modern Electronic Technique,2012,35(4):55-56.
Authors:ZHAO Juan  FAN Chao
Institution:1.North Institute of Information Engineering,Xi’an Technological University,Xi’an 710025,China; 2.Shaanxi Youth Vocational College,Xi’an 710068,China)
Abstract: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 way;the array name and pointer as parameters are passed by address,that is,they share the same address.
Keywords:delivery value  delivery address  C language function  address sharing
本文献已被 CNKI 维普 万方数据 等数据库收录!
设为首页 | 免责声明 | 关于勤云 | 加入收藏

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