龙空技术网

C语言(十二):参数和指针

LearningYard学苑 174

前言:

现在兄弟们对“c语言中参数的传递”大体比较关切,同学们都需要分析一些“c语言中参数的传递”的相关资讯。那么小编同时在网络上汇集了一些有关“c语言中参数的传递””的相关文章,希望各位老铁们能喜欢,看官们快快来学习一下吧!

分享兴趣,传播快乐,

增长见闻,留下美好!

亲爱的您,这里是LearningYard新学苑。

今天小编为大家带来的是

C语言(十二):参数和指针。

Share interests, spread happiness,

Increase your knowledge, leave behind the good!

Dear you, this is the Learning Yard New School.

What the editor brings to you today is

C Language (XII): Parameters and pointers.

一、思维导图

此推文关于参数和指针的内容主要如下:

The main content of this tweet about parameters and pointers is as follows:

二、形参和实参

形参:函数定义时所写的参数。

实参:落到实地的数值。

当函数发生调用,实参的值会传给形参,且具有单向性。

Formal parameters: parameters written during function definition.

Actual parameter: value that falls to the field.

When a function is called, the value of the actual parameter is passed to the formal parameter, and has unidirectionality.

三、传值和传址

在不使用指针的情况下传值:

To pass a value without using a pointer:

在使用指针的情况下传址:

Address with pointer:

每个函数的内部是相互独立的,不能互相访问变量(即传值)

当使用指针后,传递的是地址,通俗来讲就是将一个东西通过任意门拉入另一个世界经行改变后又送回来,这个东西本质上发生了改变(即传址)

The interiors of each function are independent of each other, and variables cannot be accessed from each other (that is, passed values)

When a pointer is used, the address is passed. Generally speaking, it means pulling something through an arbitrary door into another world, changing it, and then sending it back. This thing essentially changes (i.e., the address)

四、传数组

请看下面示例:

Take a look at the following example:

如果按照我们上部分所讲的来看,第二次打印的数组应该不会改变,但实际上改变了,说明这里传递的是数组第一个元素的地址。

If we follow the previous section, the array printed for the second time should not change, but it has actually changed, indicating that the address of the first element of the array is passed here.

五、可变参数

可变参数主要是运用在参数不确定的情况下。

主要编程结构语言如下:

Variable parameters are mainly used when parameters are uncertain.

The main programming structure languages are as follows:

第二行:定义参数列表

第三行:初始化参数列表

第四行:获取后面每一个参数的值

第五行:关闭参数列表

Line 2: Define parameter list

Line 3: Initialization parameter list

Line 4: Obtain the value of each subsequent parameter

Line 5: Close the parameter list

请看下面示例:

Take a look at the following example:

开头定义函数时省略号表示参数个数不确定,n表示参数个数。

When defining a function at the beginning, an ellipsis indicates that the number of parameters is uncertain, and n indicates the number of parameters.

结语:C语言的学习需要配合不断地练习,对于推文有什么需要改进的地方还请大家提出来。

Conclusion: The learning of C language needs continuous practice, and please provide suggestions for any improvements in tweets.

今天的分享就到这里了。

如果您对今天的文章有独特的想法,

欢迎给我们留言,

让我们相约明天,

祝您今天过得开心快乐!

That's all for today's sharing.

If you have unique ideas about today's article,

please leave us a message.

Let's meet tomorrow.

I wish you a happy day!

翻译:百度翻译

参考:《零基础入门学习C语言:带你学C带你飞》、哔哩哔哩小甲鱼视频、网络图片

声明:本文由LearningYard新学苑原创,若有侵权请联系删除

文案&排版:易春秀

审核:闫庆红

标签: #c语言中参数的传递 #c语言语句翻译 #c语言引用型参数和指针区别 #参数c语言 #配置系统参数c语言