Examveda

What will be the output of the following C++ code?
#include <iostream>
using namespace std;
double & WeeklyHours()
{
    double h = 46.50;
    double &hours = h;
    return hours;
}
int main()
{
    double hours = WeeklyHours();
    cout << "Weekly Hours: " << hours;
    return 0;
}

A. 46.5

B. 6.50

C. compile time error

D. 26.5

Answer: Option A


Join The Discussion

Related Questions on Functions and Procedures in C plus plus