answersLogoWhite

0

Nothing special... here is an example:

unsigned power (unsigned a, unsigned b)

{

if (b==0) return 1;

else return power (a, b-1) * a;

}

User Avatar

Wiki User

16y ago

What else can I help you with?

Continue Learning about Engineering

How do methods and functions differ?

A method is simply a function that is defined for a class. To invoke it, you usually need to specify an object, or the class name, followed by a dot, followed by the method name.A method is simply a function that is defined for a class. To invoke it, you usually need to specify an object, or the class name, followed by a dot, followed by the method name.A method is simply a function that is defined for a class. To invoke it, you usually need to specify an object, or the class name, followed by a dot, followed by the method name.A method is simply a function that is defined for a class. To invoke it, you usually need to specify an object, or the class name, followed by a dot, followed by the method name.


What are the three required sets of statements for every function that a programmer writes in C plus plus?

There is no requirement for any statement in a C++ function, let alone three sets of statements. For instance, the following is a perfectly valid function: void foo(){} Clearly this does nothing as it has no statements in the function body, but it is nevertheless a valid function. Perhaps you mean something else by "statements". The only requirement of a function is that it have a return type, a valid name, an argument list and a function body. The return type may be void, of course, and the argument list may be empty, but it must include the ellipses. The function declaration need not include the function body, and the argument list need only specify the type of argument (the argument names are optional and need not match those declared in the actual definition). The function name and the arguments define the function signature (the prototype), thus the three required "components" of a function are the return type, the signature and the function body.


Difference between user defined function or standard c library?

satandard fuction is pre define fuction like getch(),clrscr(), in c++ and userdefine fuction is self created by use to do a particular work ex of use definefuction int add(int a,int b) { int c; c=a+b; return(c); };


How do you Count node left and Right for binary tree using PHP Codeigniter?

To count the number of left and right nodes in a binary tree using PHP Codeigniter, you would typically need to traverse the tree recursively. You can create a function that takes the root node of the binary tree as a parameter and recursively counts the left and right nodes. Within the function, you would check if the current node has a left child and recursively call the function on the left child while incrementing the left count. Similarly, you would do the same for the right child. Finally, you would return the counts of left and right nodes.


What eliminates the need to place a function definition before all calls to the function?

In programming languages that support function declarations or prototypes, such as C and C++, the need to place a function definition before all calls is eliminated. By declaring a function before its first use, the compiler knows about the function's signature, allowing calls to be made regardless of the order of definitions. This enables better organization of code and modular programming, as functions can be defined later in the file or in separate files.

Related Questions

How do methods and functions differ?

A method is simply a function that is defined for a class. To invoke it, you usually need to specify an object, or the class name, followed by a dot, followed by the method name.A method is simply a function that is defined for a class. To invoke it, you usually need to specify an object, or the class name, followed by a dot, followed by the method name.A method is simply a function that is defined for a class. To invoke it, you usually need to specify an object, or the class name, followed by a dot, followed by the method name.A method is simply a function that is defined for a class. To invoke it, you usually need to specify an object, or the class name, followed by a dot, followed by the method name.


What is the value of f(x) when the x 6?

f(x) is a function that somehow depends on "x". Since it can be anything, you need more information - specifically, you need to know how the function is defined.


What are the three required sets of statements for every function that a programmer writes in C plus plus?

There is no requirement for any statement in a C++ function, let alone three sets of statements. For instance, the following is a perfectly valid function: void foo(){} Clearly this does nothing as it has no statements in the function body, but it is nevertheless a valid function. Perhaps you mean something else by "statements". The only requirement of a function is that it have a return type, a valid name, an argument list and a function body. The return type may be void, of course, and the argument list may be empty, but it must include the ellipses. The function declaration need not include the function body, and the argument list need only specify the type of argument (the argument names are optional and need not match those declared in the actual definition). The function name and the arguments define the function signature (the prototype), thus the three required "components" of a function are the return type, the signature and the function body.


If an original expression is defined for all values of x you do not need to specify the absolute value in the simplified expression.?

The assertion is not true. Consider the function f(x) =|x - 3|, which is the distance of x from the point 3. The function is defined for all x but the absolute value is required.


What kind of symmetry indicates that a function will not have an inverse?

If a function is even ie if f(-x) = f(x). Such a function would be symmetric about the y-axis. So f(x) is a many-to-one function. The inverse mapping then is one-to-many which is not a function. In fact, the function need not be symmetric about the y-axis. Symmetry about x=k (for any constant k) would also do. Also, leaving aside the question of symmetry, the existence of an inverse depends on the domain over which the original function is defined. Thus, y = f(x) = x2 does not have an inverse if f is defined from the real numbers (R) to R. But if it is defined from (and to) the non-negative Reals there is an inverse - the square-root function.


Difference between user defined function or standard c library?

satandard fuction is pre define fuction like getch(),clrscr(), in c++ and userdefine fuction is self created by use to do a particular work ex of use definefuction int add(int a,int b) { int c; c=a+b; return(c); };


What do you need to get in Germany?

you will need a valid passport


How do you Count node left and Right for binary tree using PHP Codeigniter?

To count the number of left and right nodes in a binary tree using PHP Codeigniter, you would typically need to traverse the tree recursively. You can create a function that takes the root node of the binary tree as a parameter and recursively counts the left and right nodes. Within the function, you would check if the current node has a left child and recursively call the function on the left child while incrementing the left count. Similarly, you would do the same for the right child. Finally, you would return the counts of left and right nodes.


Can an arithmetic sequence be odd?

An arithmetic sequence can consist of only odd numbers but it cannot be an odd function since it need not be defined for negative values of the index.


What is the value of the function when the input equals zero?

To determine the value of a function when the input equals zero, you need to evaluate the function at that specific point by substituting zero into the function's equation. For example, if the function is defined as ( f(x) = 2x + 3 ), then ( f(0) = 2(0) + 3 = 3 ). The output will vary depending on the specific function being used.


What is the Range of great integer function Why?

There is no such thing as an interger.The ceiling function is a function which maps any variable x to the next integer, or the smallest integer greater than or equal to x. Why? Because that is how the function is defined. And there are many occasions when it is applied in normal life. If you require 3.2 cans of paint to paint a wall you will need to buy 4 cans, if a school wants to take 63 children and staff no a trip and a bus has only 30 seats, you will need three buses.


Do you need for installation of Windows XP Professional to be valid and legal you must have a user license?

Yes you do need to have a valid legal license.