Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. Which statement about function parameters, arguments, and return types is incorrect? 2. Which statement about C/C++ functions in general is incorrect? Question 1 Which
1. Which statement about function parameters, arguments, and return types is incorrect?
Question 1 Which statement about function parameters, arguments, and return types is incorrect? It is recommended to pass by reference or by pointer, if the passed argument is a large compound type. Retuming the data by address or by reference requires the returning variable is not destroyed at the end of the function. When an argument is passed by const reference, there is no data copying and it can be used as the returning variable. When an argument is passed by value, the argument's value is copied into the function parameter, which will be independent from the argument ifself. Pointer itself is also a variable, which stores the address, passed by address is also kind of pass by value, except the value is the address of another object Question 4 Which statement about C/C++ functions in general is incorrect? Since functions have to be loaded to the memory, it also has an address; hence we can use a pointer to refer to a function, too. A recursive function is a function that calls itself. Although the code might read elegant, but cost of performance overhead can be an issue if recursive level is very deep. When a function is called, there is a certain amount of performance overhead (including prepare the argument and jump forward/backward): such overhead can be removed by the inline function. So we can use inline functions everywhere and no drawback. The main() function can also include two arguments like main(int argc, char *argv[]), as they are the way to pass the command line arguments In C++ lambda expression allows us to define a function inside another function, or even defined in place as a function parameter 2. Which statement about C/C++ functions in general is incorrect?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started