Go to » Web - QA - Dictionary - Encyclopedia - Images
 Web Opens New Window. Results 0 - 0 of about 0 for Formal parameter 
Sorry for the inconvenience! Unable to fulfill the request. Try the suggestions below or type a new query above.
 

 Questions 'n' Answers about 'Formal parameter' Opens New Window.

Q.Define actual parameter and formal parameter in c programming?Related Search:
Programming & Design
 Define actual parameter and formal parameter. What is meant by scope of variables & its types explain with example? help me with this..................
A.Arguments/Actual Parameters: These are the parameters, transferred from the Calling Function/Program ( main( ) program ) to the Called Function/Program ( Function ). Parameters/Formal Parameters/Dummy Parameters: These are the parameters, transferred into the Calling Function/Program ( main( ) program ) from the Called Function/Program ( Function ). sample program:------------------------------------------------------------------------------------------------------------- // Every ‘C’ program starts with the main( ) function void main( ) { float function1( float a, float b ); // Local Function Declaration Statements; f=function1( a, b ); // Function Call i.e, Calling Function // a & b are Arguments/Actual Parameters Statements; } // Function Definition (or) Body of the Function float function1( float x, float y ) // Function Call i.e, Called Function // x & y are Formal Parameters { Statements; return ( value ); // returning a float computed value to the Calling Function } ___________________________________________________________________________ Scope of Variables: The variables declared in ‘C’ programs are totally different from other languages. We can use the same variable names in the ‘C’ program in separate blocks. When we declare a variable it is available only to specific part (or) block of the program. Remaining block (or) other function cannot get access to the variable. The area (or) block of the ‘C’ program from where the variable can be accessed is known as the scope of variable. scope of variable implies the availability of variables within the program. The area (or) scope of the variable depends on its storage class i.e, where & how it is declared. There are four scope variables, a. Function b. File c. Block d. Function Prototype Variables have Two Types of Scopes described below: Both the calling function & the called function are using their own variables. The existence of these variables is restricted to the calling function (or) to the called function. This is known as scope of variables. program:_______________________________________________________________ /* Write a program to illustrate the concept of local & global variables. Here the program does not accept anything from the keyboard. It initializes the variable i to 10 outside the main( ) function & the function value( ). */ #include<stdio.h> #include<conio.h> int i=10; // global variable declaration int value( int x ); // global function declaration void main( ) { int j; // local variable declaration clrscr( ); printf( “ i = %d \n “, i ); j = value( i ); // function call printf( “ j = %d \n ”, j ); getch( ); } int value( int x ) // function definition { int k; // local variable declaration k = x + 10; return ( k ); // returning the value to the calling function } ------------------------------------------------------------------------------------------------------------- rate me :-)
  

Q.When a function having an array formal parameter is called, the formal array parameter?Related Search:
Programming & Design
 1. names a copy of the array argument 2. refers to exactly the same array as the calling program 3. is passed the address of the argument, and the function needs further information about the array size to safely use an array parameter 4. refers to the array using a name that is always different from the calling program's argument
A.3
  

Q.maplesoft:i keep getting the illegal use of a formal parameter error message please help?Related Search:
Programming & Design
 > myproc := proc (A, B) local result; a := h, i; b := j, k; result := (k-i)/(j-h); return result end proc; print(`output redirected...`); # input placeholder proc(A, B) ... end; > myproc(P1, P2); %; Error, (in myproc) illegal use of a formal parameter
A.I do NOT know what "maplesoft" is, but commonly (in most programming languages) a := h, i; would mean that you are attempting to assign a value held in var "h" TO var "a" i.e. if BEFORE that statement the values in "a" was 10 and in "h" was 3, then AFTER the execution of this statement the values in BOTH will be 3. Maybe you were meant to reverse the assignment operator?
  

Q.Using C++, can I use a reference to a base class as a formal parameter and actually pass derived classes?Related Search:
Programming & Design
 Hi. I'm an intermediate level c++ programmer, but most of my projects have been rather small and uncomplicated until now. I'm wondering if it will be possible to use a base class reference as a formal parameter, and then actually pass a reference to a derived class. For example, let's say this is the function declaration: void someFunction(baseClass &variable); And then this would be my call: someFunction(derivedClass &variable); I am wondering this because I need a "one size fits all approach" in my current project, and don't want to do a bunch of coding and then turn around and have to re-think everything. Thanks!
A.Yes, what you are proposing works fine. However, if you pass a reference to the base class, then the function treats the object as the base class. For virtual functions, the function pointer in the virtual table points to the implementation of the derived class, so your code will invoke the correct version of the function based on the class you passed in. However, if you have functions or data specific to the derived class only, then you will have to cast the base class in order to access them. Here is an example: #include <iostream> using namespace std; class Foo { public: Foo() { } ~Foo() { } virtual void printNum() { cout << 5 << endl; } }; class Bar : public Foo { public: Bar() { } ~Bar() { } virtual void printNum() { cout << 6 << endl; } }; void test( Foo& foo_r ) { foo_r.printNum(); static_cast<Bar*>(&foo_r)->printNum(); } int main( int argc, char **argv ) { Bar bar; test( bar ); return 0; } In this program, the test() function prints out: 6 6 If you remove the virtual keyword from both printNum() functions, then the test() function prints out: 5 6
  

Q.can u plz. tell me the difference between actual & formal parameter in c++?Related Search:
Programming & Design
 it is related to functions
A.formal parameter are when u define the function : void printnumber( int x ) { cout<<x;} in this case the variable x is a formal parameter But actual parameters are when u call the functions : void main() { int y = 10 ; printnumber(y); } in this case, the variable called y is an actual parameter
  
 Dictionary Opens New Window.

Click on the word below to see the definition:
 
 Encyclopedia Opens New Window.

For other uses, see Parameter (disambiguation).

In mathematics, statistics, and the mathematical sciences, a parameter (G: auxiliary measure) is a quantity that serves to relate functions and variables using a common variable (often t) when such a relationship would be difficult to explicate with an equation. In different contexts the term may have special uses.

Contents

[edit] Examples

  • In a section on frequently misused words in his book The Writer's Art, James J. Kilpatrick quoted a letter from a correspondent, giving examples to illustrate the correct use of the word parameter:
W.M. Woods...a mathematician...writes... "...a variable is one of the many things a parameter is not." ... The dependent variable, the speed of the car, depends on the independent variable, the position of the gas pedal.
[Kilpatrick quoting Woods] "Now...the engineers...change the lever arms of the linkage...the speed of the car...will still depend on the pedal position...but in a...different manner. You have changed a parameter"
  • A parametric equaliser is an audio filter that allows the frequency of maximum cut or boost to be set by one control, and the size of the cut or boost by another. These settings, the frequency level of the peak or trough, are two of the parameters of a frequency response curve, and in a two-control equaliser they completely describe the curve. More elaborate parametric equalisers may allow other parameters to be varied, such as skew. These parameters each describe some aspect of the response curve seen as a whole, over all frequencies. A graphic equaliser provides individual level controls for various frequency bands, each of which acts only on that particular frequency band.
  • If asked to imagine the graph of the relationship y = ax2, one typically visualizes a range of values of x, but only one value of a. Of course a different value of a can be used, generating a different relation between x and y. Thus a is considered to be a parameter: it is less variable than the variable x or y, but it is not an explicit constant like the exponent 2. More precisely, changing the parameter a gives a different (though related) problem, whereas the variations of the variables x and y (and their interrelation) are part of the problem itself.
  • In calculating income based on wage and hours worked (income equals wage multiplied by hours worked), it is typically assumed that the hours worked is easily changed, but the wage is more static. This makes wage a parameter in this formula.

[edit] Parameters in mathematics and science

[edit] Mathematical functions

Mathematical functions have one or more arguments that are designated in the definition by variables, while their definition can also contain parameters. The variables are mentioned in the list of arguments that the function takes, but the parameters are not. When parameters are present, the definition actually defines a whole family of functions, one for every valid set of values of the parameters. For instance one could define a general quadratic function by defining

f(x) = ax2 + bx + c;

here the variable x designates the function argument, but a, b, and c are parameters that determine which quadratic function one is considering. The parameter could be incorporated into the function name to indicate its dependence on the parameter; for instance one may define the base a logarithm by

\log_a(x)=\frac{\ln(x)}{\ln(a)}

where a is a parameter that indicates which logarithmic function is being used; it is not an argument of the function, and will for instance be a constant when considering the derivative \textstyle\log_a'(x).

In some informal situations people regard it as a matter of convention (or historical accident) whether some or all the symbols in a function definition are called parameters. However changing the status of symbols between parameter and variable changes the function as a mathematical object. For instance the notation for the falling factorial power

n^{\underline k}=n(n-1)(n-2)\cdots(n-k+1),

defines a polynomial function of n (when k is considered a parameter), but is not a polynomial function of k (when n is considered a parameter); indeed in the latter case it is only defined at non-negative integer arguments.

In the special case of parametric equations the independent variables are called the parameters.

[edit] Analytic geometry

In analytic geometry, curves are often given as the image of some function. The argument of the function is invariably called "the parameter". A circle of radius 1 centered at the origin can be specified in more than one form:

  • implicit form
x2 + y2 = 1
  • parametric form
(x,y)=(\cos \; t,\sin \; t)
where t is the parameter.

A somewhat more detailed description can be found at parametric equation.

[edit] Mathematical analysis

In mathematical analysis, integrals dependent on a parameter are often considered. These are of the form

F(t)=\int_{x_0(t)}^{x_1(t)}f(x;t)\,dx.

In this formula, t is the argument of the function F, and on the right-hand side the parameter on which the integral depends. When evaluating the integral, t is held constant, and so it considered a parameter. If we are interested in the value of F for different values of t, then, we now consider it to be a variable. The quantity x is a dummy variable or variable of integration (confusingly, also sometimes called a parameter of integration).

[edit] Probability theory

These traces all represent Poisson distributions, but with different values for the parameter λ

In probability theory, one may describe the distribution of a random variable as belonging to a family of probability distributions, distinguished from each other by the values of a finite number of parameters. For example, one talks about "a Poisson distribution with mean value λ". The function defining the distribution (the probability mass function) is:

f(k;\lambda)=\frac{e^{-\lambda} \lambda^k}{k!}.

This example nicely illustrates the distinction between constants, parameters, and variables. e is Euler's Number, a fundamental mathematical constant. The parameter λ is the mean number of observations of some phenomenon in question, a property characteristic of the system. k is a variable, in this case the number of occurrences of the phenomenon actually observed from a particular sample. If we want to know the probability of observing k1 occurrences, we plug it into the function to get f(k1;λ). Without altering the system, we can take multiple samples, which will have a range of values of k, but the system will always be characterized by the same λ.

For instance, suppose we have a radioactive sample that emits, on average, five particles every ten minutes. We take measurements of how many particles the sample emits over ten-minute periods. The measurements will exhibit different values of k, and if the sample behaves according to Poisson statistics, then each value of k will come up in a proportion given by the probability mass function above. From measurement to measurement, however, λ remains constant at 5. If we do not alter the system, then the parameter λ is unchanged from measurement to measurement; if, on the other hand, we modulate the system by replacing the sample with a more radioactive one, then the parameter λ would increase.

Another common distribution is the normal distribution, which has as parameters the mean μ and the variance σ².

It is possible to use the sequence of moments (mean, mean square, ...) or cumulants (mean, variance, ...) as parameters for a probability distribution.

[edit] Statistics and econometrics

In statistics and econometrics, the probability framework above still holds, but attention shifts to estimating the parameters of a distribution based on observed data, or testing hypotheses about them. In classical estimation these parameters are considered "fixed but unknown", but in Bayesian estimation they are treated as random variables, and their uncertainty is described as a distribution.[citation needed]

It is possible to make statistical inferences without assuming a particular parametric family of probability distributions. In that case, one speaks of non-parametric statistics as opposed to the parametric statistics described in the previous paragraph. For example, Spearman is a non-parametric test as it is computed from the order of the data regardless of the actual values, whereas Pearson is a parametric test as it is computed directly from the data and can be used to derive a mathematical relationship.

Statistics are mathematical characteristics of samples which can be used as estimates of parameters, mathematical characteristics of the populations from which the samples are drawn. For example, the sample mean (\overline X) can be used as an estimate of the mean parameter (μ) of the population from which the sample was drawn.

[edit] Other fields

Other fields use the term "parameter" as well, but with a different meaning.

[edit] Logic

In logic, the parameters passed to (or operated on by) an open predicate are called parameters by some authors (e.g., Prawitz, "Natural Deduction"; Paulson, "Designing a theorem prover"). Parameters locally defined within the predicate are called variables. This extra distinction pays off when defining substitution (without this distinction special provision has to be made to avoid variable capture). Others (maybe most) just call parameters passed to (or operated on by) an open predicate variables, and when defining substitution have to distinguish between free variables and bound variables.

[edit] Engineering

In engineering (especially involving data acquisition) the term parameter sometimes loosely refers to an individual measured item. This usage isn't consistent, as sometimes the term channel refers to an individual measured item, with parameter referring to the setup information about that channel.

"Speaking generally, properties are those physical quantities which directly describe the physical attributes of the system; parameters are those combinations of the properties which suffice to determine the response of the system. Properties can have all sorts of dimensions, depending upon the system being considered; parameters are dimensionless, or have the dimension of time or its reciprocal."[1]

The term can also be used in engineering contexts, however, as it is typically used in the physical sciences.

[edit] Computer science

When the terms formal parameter and actual parameter are used, they generally correspond with the definitions used in computer science. In the definition of a function such as

f(x) = x + 2,

x is a formal parameter. When the function is used as in

y = f(3) + 5 or just the value of f(3),

3 is the actual parameter value that is substituted for the formal parameter in the function definition. These concepts are discussed in a more precise way in functional programming and its foundational disciplines, lambda calculus and combinatory logic.

In computing, parameters are often called arguments, and the two words are used interchangeably. However, some computer languages such as C define argument to mean actual parameter (i.e., the value), and parameter to mean formal parameter.

[edit] Linguistics

Within linguistics, the word "parameter" is almost exclusively used to denote a binary switch in a Universal Grammar within a Principles and Parameters framework.

[edit] References

  1. ^ John D. Trimmer, 1950, Response of Physical Systems (New York: Wiley), p. 13

[edit] See also



All text is available under the terms of the GNU Free Documentation License. (See Copyrights for details.)
Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc.
Privacy policy - About Wikipedia - Disclaimers - Fundraising
 
 Images Opens New Window.
File Size: 10.5k
Dimensions: 323 x 787 pixels
File Format: png
File Size: 21.099609375k
Dimensions: 373 x 425 pixels
File Format: jpeg
File Size: 19.099609375k
Dimensions: 338 x 623 pixels
File Format: gif
File Size: 10.19921875k
Dimensions: 526 x 598 pixels
File Format: png
File Size: 172.7998046875k
Dimensions: 813 x 989 pixels
File Format: jpeg
File Size: 34.099609375k
Dimensions: 404 x 720 pixels
File Format: png
File Size: 14.2998046875k
Dimensions: 489 x 583 pixels
File Format: gif
File Size: 32.2998046875k
Dimensions: 369 x 607 pixels
File Format: gif
File Size: 49k
Dimensions: 478 x 560 pixels
File Format: jpeg
File Size: 16.599609375k
Dimensions: 470 x 727 pixels
File Format: gif
File Size: 3.599609375k
Dimensions: 413 x 440 pixels
File Format: gif
File Size: 53.69921875k
Dimensions: 464 x 518 pixels
File Format: jpeg
 
 MORE IMAGES »  
Go to » Web - QA - Dictionary - Encyclopedia - Images