answersLogoWhite

0

What is a parameter passing?

Updated: 8/10/2023
User Avatar

Wiki User

9y ago

Best Answer

Passing parameters probably means passing a parameter into a function.Basically, this happens when you call a function.

You put the parameter into a function, then call it, and the function does something to the parameters you put into it.

Here's an example:

#include <iostream>

using namespace std;

int sum(int a, int b); //Declare the function, so the program knows that it exists

int main() {

int first, second, total;

cout<<"Please insert two numbers."<<endl;

cin>>first>>second;

total=sum(first, second); /*Here we are passing the variables (parameters) "first" and "second" into the function "sum". This function then does something to them and outputs the value. In this case, it is stored in the variable "total"*/

cout<<"Their sum is "<<total<<"."<<endl;

return 0;

}

//Here we define the function (tell the program what to do)

int sum(int a, int b) { //We pass two integers into the function. Their values are stored in a and b. a and b can then be used by the function.

sum=a+b;

return sum;//Adds them, then returns the sum

}

User Avatar

Wiki User

7y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

14y ago

in programming parameter passing refers to give the values of x and y. for example a function Add() adds two numbers x and y, now it needs two value we pass parameters 2 and 3 to it. Add(2,3) the answer is 5.

my email :steelspider2099@hotmail.com

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is a parameter passing?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What does parameter passing in c means?

parameter passing in c, what does it do?


Different parameter passing methods with examples?

explain parameter passing methods c program


What is call by refrence?

When calling a function, passing a variable's address as function parameter.


Definition for call by value in c?

This is the only possible way of parameter-passing in C language.


Which is the default parameter passing technique in c plus plus language?

The default is to pass by value.


Is it possible to use two parameter passing methods?

The number of parameters is zero or more, so two is perfectly okay.


Is A query that prompts for input whenever it is run is a run-time query?

It is referred to as a parameter query.It is referred to as a parameter query.It is referred to as a parameter query.It is referred to as a parameter query.It is referred to as a parameter query.It is referred to as a parameter query.It is referred to as a parameter query.It is referred to as a parameter query.It is referred to as a parameter query.It is referred to as a parameter query.It is referred to as a parameter query.


Why is parameter passing useful to programmers?

Because all software is written using functions and classes. If you do not know how to pass data from class to class, to function you are not a programmer.


What is the parameter of the Earth?

what is the parameter of earth


Why and when should programmers use a constant reference parameter?

when we use that parameter as a global parameter and we used that parameter through out the program without changing


What does parameter mean in science?

A parameter is something that limits something else. A parameter is a limit, or a boundary.


What is a parameter in maths?

A parameter is like a limit or a specification.