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
Question: (a) Explain a linked list. (b) Describe the three different types of linked list with the help of diagrams. (c) Give two advantages and two disadvantages

Write two different arrays. Store the names in it and then compare if both the names entered by the user are the same.

Program is to read the contents of a file: void main()    {   ifstream fin("ascii.txt");   char ch;   while(! fin.eof())     {   fin>>ch;   cout     }

it is a class enclosed in the scope of another class. For illustration: // Example: Nested class // class OuterClass { class NestedClass { // ... }; // .

Project Description: We are seeking online invoice OCR solution. That will help us to automate accounts payable function. User should be able to use the offered pdf file or s

What is the real function of class - to export data? No, Real purpose of a class isn't to export data. Instead, it's to provide services. Class provides a way to abstract behav

coloring of elements in matrix form inm particular matrix.the color should not match with another color.

write a program that counts the number of occurences of the string in the n-th Padovan string P(n) program in java // aakash , suraj , prem sasi kumar kamaraj college progr

The absolute land-speed record of 763.035 MPH (Mach 1.02) was set in October 15 1997 by a jet-powered car called Thrust SSC in the Black Rock Desert of northern Nevada. The team th