When are temporary variables formed by c++ compiler?, C/C++ Programming

A: Provided that function parameter is "const reference", compiler create temporary variable in following two ways.

a) The actual argument is the correct type, however it isn't Lvalue

double Cube(const double & num)

{

num = num * num * num;

return num;

}

double temp = 2.0;

double value = cube(3.0 + temp); // argument is a expression and not a Lvalue;

b) The actual argument is of the wrong type, however of a type which can be converted to the correct type

long temp = 3L;

double value = cuberoot ( temp); // long to double conversion

 

Posted Date: 3/21/2013 7:28:18 AM | Location : United States







Related Discussions:- When are temporary variables formed by c++ compiler?, Assignment Help, Ask Question on When are temporary variables formed by c++ compiler?, Get Answer, Expert's Help, When are temporary variables formed by c++ compiler? Discussions

Write discussion on When are temporary variables formed by c++ compiler?
Your posts are moderated
Related Questions
Explain redirection in c++

TO CONVERT A NUMBER OR A DIGIT INTO ALPHABET

Create a program WordCount1Main.java doing the following:  For each word in the le word.txt { Create an object of the class Word { Add the object to a set of the type java.uti

A: The inline keyword tells the compiler to substitute the code in the function de_nition for each instance of a function call. Though, substitution takes place only at the compile


Develop a function to calculate sum of n even integers starting from a given even integer

6999066263304447777077766622337778 -----> message sent by the first smuggler. my name is robert---------> message decoded by the second smuggler. Where ‘0’ denotes the "space".

wap to read an employee salary and calculate DA,HRA,pf,GROSS,NET conditions:- BASIC DA HRA PF >10000 7% 9% 10% & >20000 9% 11% 15% &

Goals For this assignment you will write programs in C and LC-3 assembly code. Both programs will perform the identical recursive algorithm. The goals of this programming assignmen

Pointer to function: int mul(int a, int b, int c) {   return a*b*c; } void main() {   int (*function_pointer)(int, int, int);   function_pointer = &mul;