Mega Code Archive

 
Categories / C++ / Pointer
 

How to use the address operator to assign the address of a variable to a pointer

#include <iostream> using namespace std; int main () {    int num = 5;    int* intPointer = &num;    cout << "The address of x using &num is " << &num << endl;    cout << "The address of x using intPointer is " << intPointer << endl;    return 0; }