Question: 1) In function `_start': undefined reference to `main' error: cout was not declared in this scope 2) Declare an integer variable, x, initialized with the

1) In function `_start': undefined reference to `main'

error: cout was not declared in this scope

2) Declare an integer variable, x, initialized with the value 6, and a reference to x called ref.

Given your declarations above and the following code:

int y = 5;

ref = y;

ref = 7;

What are the respective values of x and y?

3)Declare a function foo that takes an int, an int reference, and a bool.

4) Should you pass a variable by value, by reference, or by const reference?

  • if its a basic type that you dont want to modify

  • if its a composite (non-basic) type that you dont want to modify

  • if its a basic type that you do want to modify

  • if its a composite type that you do want to modify

5) What is wrong with this code?

int& foo(int x) {

int& y = x;

return y;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!