answersLogoWhite

0


Best Answer

You pass arguments to functions because that is how you tell the function what you want it to do. If you had, for instance, a function that calculated the square root of something, you would pass that something as an argument, such as a = sqrt (b). In this case sqrt is the function name, b is passed as its argument, and the return value is assigned to a.

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Why you pass arguments to function in c plus plus?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How will you pass arguments to a function in c plus plus?

If you have this function: int add(int x, int y) { return x + y; } you would pass the arguments when calling the function in the () like this: add(4, 7); 4 & 7 would be the arguments.


Can you pass addresses to a function in C plus plus?

If the identifier you want to pass is an ordinary identifier, pass it as the address of... function(&identifier); If the identifier you want to pass is an array identifier, pass its name... function(arrayname);


What is meant by arguments in c?

Arguments appear in functions and in function calls. Arguments passed to a function are known as actual arguments. The arguments used by the function are known as the formal arguments. In C, all arguments are passed by value, such that the formal argument is a copy of the actual argument.


Is it possible in C plus plus builder xe to pass objects like TSQLConnection object to a dll as a parameter if yes then how?

Pass the object by reference to a function in the DLL.


What are the building function in c plus plus?

There is no such term as "building function" in C++.


What is parameters in C plus plus?

In C++, parameters are variables declared in the function's declaration and definition that receive values passed in from the function call. They are used to pass values or data into a function to be used within the function's code. Parameters allow functions to be more flexible and reusable by accepting different inputs without needing to modify the function's code.


How do you pass command line arguments using turbo in c compiler?

In the Options menu the Arguments command.


If you got a c plus and you need a c do you pass?

Yes, if you need a C to pass, and you have a C+, you pass.


What is a call by reference?

In C++ (C Plus Plus), when you call by reference, you are directly accessing the data of the referenced object. When you pass an object to a function by reference, any and all alterations to the object made within the function carry through to the actual object.


What is calling by reference?

In C++ (C Plus Plus), when you call by reference, you are directly accessing the data of the referenced object. When you pass an object to a function by reference, any and all alterations to the object made within the function carry through to the actual object.


When calling a function that has multiple parameters can you list the arguments in any order?

No. C function argument are positional.


What are the different types of function in c plus plus programming?

There are five types of functions and they are:Functions with no arguments and no return values.Functions with arguments and no return values.Functions with arguments and return values.Functions that return multiple values.Functions with no arguments and return values.Functions with no arguments and no return value.A C function without any arguments means you cannot pass data (values like int, char etc) to the called function. Similarly, function with no return type does not pass back data to the calling function. It is one of the simplest types of function in C. This type of function which does not return any value cannot be used in an expression it can be used only as independent statement.Functions with arguments and no return value.A C function with arguments can perform much better than previous function type. This type of function can accept data from calling function. In other words, you send data to the called function from calling function but you cannot send result data back to the calling function. Rather, it displays the result on the terminal. But we can control the output of function by providing various values as arguments. Functions with arguments and return value.This type of function can send arguments (data) from the calling function to the called function and wait for the result to be returned back from the called function back to the calling function. And this type of function is mostly used in programming world because it can do two way communications; it can accept data as arguments as well as can send back data as return value. The data returned by the function can be used later in our program for further calculations. Functions with no arguments but returns value.We may need a function which does not take any argument but only returns values to the calling function then this type of function is useful. The best example of this type of function is "getchar()" library function which is declared in the header file "stdio.h". We can declare a similar library function of own. Functions that return multiple values.So far, we have learned and seen that in a function, return statement was able to return only single value. That is because; a return statement can return only one value. But if we want to send back more than one value then how we could do this? We have used arguments to send values to the called function, in the same way we can also use arguments to send back information to the calling function. The arguments that are used to send back data are called Output Parameters.It is a bit difficult for novice because this type of function uses pointer