Write your answers to the following questions in a flat text file
hwkReferences.txt (not a Word document nor a Rich Text Format file):
- Name two or more difference between references and pointers.
- Declare a variable named intRef that is a reference to an int and is a reference to a variable named counter.
- Provide an invalid use of a reference and explain why it is invalid.
- Given the code below, explain what the logical error is.
#include <iostream>
#include "LargeObject.h"
using namespace std;
LargeObject& getAnswer(){
LargeObject result;
return result;
}
int main(){
LargeObject& answer = getAnswer();
return 0;
}
- Write the implementation for multipleBy2() so that all of the following code executes and prints out just 6:
int num = 3;
multipleBy2( num);
std::cout << num;
Submission
Submit your txt file at
https://3110.cs.mtsu.edu/. For further instructions, please see the
Miscellaneous page.
Rubric:
Points Item
--------- --------------------------------------------------------------
_____ / 2 1
_____ / 1 2
_____ / 2 3
_____ / 1 4
_____ / 2 5
_____ / 8 Total
Last Modified: