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
Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particular colour. Nec

Differentiate between the expression "++a" and "a++"? - With ++a, increment happens first on variable a, and resulting value is used. This is known as prefix increment. - Wi

answer for tcs is working question

Create the following program or propose one of your own. The program must include at least one of each of the following. Decision structure Repetitive structure fu

Describe what is actual arguments? - When certain functions are created and used to perform an action on some provided values, some values are required to be passed to them. Th


Define Commonly Used Built-in Library Functions? Comprise opened a file pointer you will desire to use it for either input or output. The C language supplies a set of functions

Implement multiple stacks in a single dimensional array using c.

payment system, in c++ only..just use the printf or scanf.please

Respected Sir, I want the above written text in a C program