Site icon T4Tutorials.com

Pointers Easy Tutorial

Pointers Easy Tutorial

pointer is a variable used to store the address of another variable., We need to declare a pointer before using the pointer in the program, just Like any variable or constant.

How to declare the pointer variable?

The general syntax of a pointer variable declaration is mentioned below;

type * variable name;

The basic program of Pointers

#include <iostream>

using namespace std;
int main () {
   int  Variable1;
   char Variable2[5];

   cout << "Address of Variable1: ";
   cout << &Variable1 << endl;

   cout << "Address of Variable2: ";
   cout << &Variable2 << endl;

   return 0;
}

 

 

Exit mobile version