• October 27, 2021

PHSARIT

Bring Technology Ideas with you

 Create Pointer in C++
#include <iostream>
using namespace std;


int main()
{
	//datatype (int, float, char, etc.) *pointer name;
	float *myPointer; 
	float value;
	myPointer = &value; // set address of value to equal pointer
	cout << "Please enter the value: ";
	cin >> value;
	//cout << "Value: " << value << endl;
	cout << "Value of the address of value is: " << myPointer<< endl; // show the addresss
	// get value from user input
	cout << " The value from address is: " << *myPointer << endl;

	cout << endl;
	system("pause==0");
}

Related post