Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C++ put together a program to discover the answers 1) For each of the following, write a single statement that performs the specified task.

In C++ put together a program to discover the answers

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

a) Declare the variable float_ptr to be a pointer to an object of type float.

b) Declare the variable int_ptr to be a pointer to an object of type int

c) Assign the address of variable value1 to pointer variable int_ptr.

d) Print the value of the object pointed to by int_ptr.

e) Assign the value of the object pointed to by int_ptr to the variable value2.

f) Print the value of value2.

g) Print the address of value1.

h) Print the address stored in int_ptr. Is the value printed the same as value1s address?

Problem #3, Chapter 7

Will the three memory locations displayed by the following program all be the same? Explain what is going on in the code.

#include

using namespace std;

int main()

{

int a = 10;

int& b = a;

int* c = &b;

cout << &a <

cout <<&b <

cout << &(*c) <

return 0;

}

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Spatial And Temporal Databases 10th International Symposium Sstd 2007 Boston Ma Usa July 2007 Proceedings Lncs 4605

Authors: Dimitris Papadias ,Donghui Zhang ,George Kollios

2007th Edition

3540735399, 978-3540735397

More Books

Students also viewed these Databases questions