Simple Pointer Example Program In C++
Definition
The pointer is a one of the C++ programming language data-type whose value refers directly to (or "points to") another value stored elsewhere in the computer memory using its address.
Pointer Variable Assign Syntax:
pointer_vaibale = &variable;
C++ Example Pointer Program:
#include<iostream>
#include<conio.h>
using namespace std;
int main() {
int i = 10;
int *Ptr;
Ptr = &i;
cout << "\nValue Of i :" << i;
cout << "\nAddress Of i :" << i;
cout << "\nValue Of Ptr :" << Ptr;
cout << "\nAddress Of Ptr :" << &Ptr;
cout << "\nPtr's Pointer Value:" << *Ptr;
cout << "\nPtr Equal to &i :" << *(&i);
}
Sample Output
Value Of i :10
Address Of i :10
Value Of Ptr :0x6dfefc
Address Of Ptr :0x6dfef8
Ptr's Pointer Value:10
Ptr Equal to &i :10
(Output may vary based on system and its memory)
C++ Pointer Example Programs
- Simple Pointer Example Program In C++
- Simple Program for Print address of Variable Using Pointer in C++
- Pointer Simple Example Program with Reference operator (&) and Dereference operator (*)
- Simple Example Program for Swap Numbers Using Pointers In C++
- Print size of different types Using Pointer in C++
- Simple Program for Add Two Numbers Using Pointer in C++
- Simple Program for Increment and Decrement Integer Using Pointer in C++
- Simple Program for Increment and Decrement Floating Point Using Pointer in C++
- Simple Program for Find a difference between two Numbers Using Pointer in C++
- Simple Program for Print String Using Pointer in C++
- Simple Program for Count vowels String Using Pointer in C++
- Simple Program for Length of String Using Pointer In C++
- Pointer to Pointer or Double Pointer Example Program In C++
- Simple Program for Pointer and Array Example in C++
- Simple Program for Sum of Integer an array using pointers in C++
- Simple Program for Read, Print and Sum of Integer in an array using pointers in C++
- Simple Example Program for Passing pointers to functions In C++
- Simple Example Program for Area Of Circle Using Pointer In C++
Read More Articles
- Simple Merge Sort Program in C++
- Scope Resolution Operator In C++
- Simple Program for Virtual Functions Using C++ Programming
- Simple Class Example Program For Find Prime Number In C++
- Simple Example Program For Parameterized Constructor In C++
- Define Constructor in Outside Class Example Program In C++
- Simple Example Program For Copy Constructor In C++
- Simple Program for Function Overloading Using C++ Programming
- Simple Program for Single Inheritance Using C++ Programming
- Simple Program for Inline Function without Class Using C++ Programming
- Factorial Using Function Example Program In C++
- Simple Example Program For Constructor Overloading In C++
- Simple Example Program For Constructor In C++
- Simple Addition ( Add Two Integers ) Example Program
- Simple Example Program for Inline Function Using C++ Programming
- Simple Program for Read user Input Using cin
- Factorial Using Loop Example Program In C++
- Simple Stack Program in C++ Programming
- Simple Program for Friend Function Using C++ Programming
- Simple Program for Static Data and Member Function Using C++ Programming
- Simple Program for Unary Operator Overloading Using C++ Programming
- Simple Program for Multiple Inheritance Using C++ Programming
- Do While Loop Example Program In C++
- Simple Copy Constructor Example Program For Find Factorial In C++
- Simple Program for Function Template Using C++ Programming