当前位置:网站首页>3、 Are formal and actual parameters in a programming language variables?
3、 Are formal and actual parameters in a programming language variables?
2022-07-28 20:05:00 【A programmer who loves playing badminton】
problem 1: What are formal and actual parameters ?
Formal parameters are when we define functions , Parameters written in parentheses
The argument is when we call the function , Incoming parameter
The number of formal and actual parameters must be the same , The positions should correspond one by one , Data types should be compatible
problem 2: Are formal parameters and arguments a variable ?
No , Formal and actual parameters are never a variable
Let's verify whether the arguments and formal parameters are variables
#include <iostream>
#include <stdio.h>
using namespace std;
void test(int i)
{
i = 99;
printf(" Shape parameter i The address for :%#X\n", &i);
}
int main(int argc, char const *argv[])
{
int i = 6;
printf(" Actual parameters i The address for %#X\n", &i);
test(i);
printf(" after test Function to get i by %d\n", i);
return 0;
}
i By function test after ,i The value of has not changed , And the shape parameter i And real parameters i The address of is different , This further illustrates that arguments and formal parameters are not variables .
边栏推荐
猜你喜欢

Thoroughly understand bit operations - shift left, shift right

Source insight project import and use tutorial

时间转日期的sql语句应该怎么写?

JS preventdefault() keyboard input limit onmousewheel stoppropagation stop event propagation

Rand function generates pseudo-random numbers

English Translation Spanish - batch English Translation Spanish tools free of charge

A chip company fell in round B

Sprint for golden nine and silver ten, stay up at night for half a month, collect 1600 real interview questions from Android post of major manufacturers
![[C language] Hanoi Tower problem [recursion]](/img/d8/ff66928c2bc2ad906e38a360a8cf94.png)
[C language] Hanoi Tower problem [recursion]

Cell review: single cell methods in human microbiome research
随机推荐
Use Hal Library of STM32 to drive 1.54 inch TFT screen (240*240 st7789v)
Handan, Hebei: expand grassroots employment space and help college graduates obtain employment
Leetcode day3 employees who exceed the manager's income
[C language] guessing numbers game [function]
Edge detection and connection of image segmentation realized by MATLAB
[wechat applet development] page navigation and parameter transmission
Rand function generates pseudo-random numbers
Overcome the "fear of looking at teeth", and we use technology to change the industry
Sequential linear table - practice in class
河北邯郸:拓展基层就业空间 助力高校毕业生就业
[C language] simulation implementation of pow function (recursion)
1. C language variable type, global variable, local variable
Basic knowledge of communication network 01
软考高级考试中有五大证书,哪个更值得考?
Implementation of memcpy in C language
Article translation software - batch free translation software supports major translation interfaces
leetcode day5 删除重复的电子邮箱
Basic knowledge of C language
党员故事|李青艾用漫画带动农民增收致富
Leetcode Day1 score ranking