For each of the following, write a single statement that performs the specified task. Assume that long variables value1 and value2 have been declared and value1 has been initialized to 200000.

a) Declare the variable longPtr to be a pointer to an object of type long.
b) Assign the address of variable value1 to pointer variable longPtr.
c) Print the value of the object pointed to by longPtr.
d) Assign the value of the object pointed to by longPtr to variable value2.
e) Print the value of value2.
f) Print the address of value1.
g) Print the address stored in longPtr. Is the value printed the same as value1’s address?


a) long *longPtr;
b) longPtr = &value1;
c) cout << *longPtr << '\n';
d) value2 = *longPtr;
e) cout << value2 << '\n';
f) cout << &value1 << '\n';
g) cout << longPtr << '\n'; yes.

Computer Science & Information Technology

You might also like to view...

In the derived class definition, you list from the base class

a. all the member functions every time b. only those member functions that need to be redefined c. only those member functions that were in the public section d. only those member functions you want to overload.

Computer Science & Information Technology

Two types of hyperlinks, to a(n) ________ or an e-mail address, link the audience to these Internet resources

Fill in the blank(s) with correct word

Computer Science & Information Technology

If you deselect the All day event check box in the Event window, the event automatically becomes a(n) ____.

A. task B. meeting C. appointment D. recurring event

Computer Science & Information Technology

When a PowerShell user needs additional help regarding a cmdlet that will create a file, what command syntax can be used to help obtain this information?

cmdlet "create file" "create file" Help Help "create file" "create file" cmdlet

Computer Science & Information Technology