195k views
8 votes
Write a program that defines an object of type double. Define a pointer that points to that

object. Print the value of the pointed-to object by dereferencing a pointer.

User CtheSky
by
3.9k points

1 Answer

9 votes

Answer:

#include <iostream>

using namespace std;

int main()

{

//make a double

double object = 1.5;

//make a pointer

double* pointer;

//make the pointer point to address of the object

pointer = &object;

//print by dereferencing a pointer

cout<<*pointer;

return 0;

}

User Bilal Qandeel
by
4.6k points