answersLogoWhite

0

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

User Avatar

Wiki User

11y ago

What else can I help you with?

Related Questions

Why a parameter is said to be a constant?

It should not be said to be a constant.


Difference between pass by value and pass by reference?

When you pass by value you pass a copy of the name. That is, the function's parameter is assigned the value of the name you pass. If the function parameter is a class type, then that class' copy constructor is called, automatically, which assigns the name's member value(s) to a new instance of the class. The function parameter is temporary, it has local scope, and will therefore fall from scope when the function returns. Thus any changes made to the local name within the function have no effect on the name you passed -- they are completely separate names. When you pass by reference you pass the name itself. To be precise, you pass the memory address of the name, its reference. This address is assigned to the function's reference parameter. Thus any changes made to the reference parameter's value will change the name you passed, since they both refer to the same memory address. Passing by reference is the most efficient method of passing objects (instances of a class) to functions as there is no overhead in copying the object. And if a reference parameter is declared constant then you can be assured the function will not alter the immutable members of the object (while there are ways around this, if a function really intends to alter a reference parameter then it should not be declared constant in the first place). Pass by value should only be used when the value is a primitive data type (generally equal to or smaller than a pointer), or when the function needs to alter the value but must not alter the name that was passed. Note that pointers are always passed by value, but since they can store a memory address they can be treated just as if they were references (assuming the pointer is non-zero of course). When passing pointers, the pointer and the address being pointed at can both be independently declared constant (that is, either, both, or neither can be constant). To pass a pointer by reference you must pass a pointer-to-pointer type, which is itself passed by value. This allows the function to not only modify the address being pointed at (making it point to another address), but to also modify the value at that address, just as if you'd passed the value by reference.


What is a variable that is used within a function?

If the variable is declared within the function body, it is a local variable, one that is local to the function. Local variables fall from scope when the function returns, they are only accessible within the function. However, local variables can be returned by value, which creates an automatic variable that is returned to the caller. If the caller does not store the return value, the automatic variable falls from scope when the expression containing the function call ends. However, the expression may evaluate the return value without storing it. Note that functions cannot return local variables by reference since the local variable falls from scope when the function returns. If the variable is passed as an argument to the function, then the variable is a parameter of the function. Arguments may be passed by value or by reference, depending upon the function signature. Passing by value means the function parameter is a copy of the argument (if the argument is an object, the object's copy constructor is invoked automatically). Thus any changes made to the parameter within the function are not reflected in the argument that was originally passed, and the parameter will fall from scope when the function returns. However, the value of the parameter can be returned as previously explained. Passing by reference means the function parameter refers directly to the argument that was passed. Thus any changes made to the parameter are reflected in the argument. Parameters that are declared as constant references assure the caller that the reference's immutable members will not be altered by the function. If the parameter is a non-const reference but the caller does not wish changes to be reflected in the argument, the caller should pass a copy of the argument instead.


What state should a reference point be in to be used to determine motion?

A reference point should be in a state of rest or constant motion in order to accurately determine the motion of other objects. This allows for easier comparison and observation of the movement of other objects relative to the reference point.


Why parameter should not change?

In statistics the parameters of the distributions of populations are the fundamental values of interest. In a way the randomness just gets in the way of learning about the parameters. They are considered constant because they define or characterise the distributions of populations.


What is parameter is parameter is?

formal parameter is we accept in function body/defination actual parameter is we pass from calling function to function body. Ex : int a,b; void add (a,b) ; where a & b is actual parameter // calling function void add(int i,int j) where i & j are formal parameter // function body { } By Darshan Paliwal


Who invented the programs on the computer?

Different programmers, I think. Maybe you should specify which program do you mean. PS: In many programs, the Help/About shows some information about the programmers.


What should you declare in a function prototype?

storage_class return_type name parameter-list


What is the difference a parameter and a statistic?

A parameter is a number describing something about a whole population. eg population mean or mode. A statistic is something that describes a sample (eg sample mean)and is used as an estimator for a population parameter. (because samples should represent populations!)


What is the difference between a parameter and a statistic?

A parameter is a number describing something about a whole population. eg population mean or mode. A statistic is something that describes a sample (eg sample mean)and is used as an estimator for a population parameter. (because samples should represent populations!)


Which state should a reference point be to be used to determine?

The reference point should be stationary, or not moving.


1 What issues should systems analysts and programmers discuss before they proceed with the project?

the programmers and the analyst need to brainstorm on the structure, coding, and user interface of the desired system before they proceed with the project.