Object
Write a program to declare an integer and a pointer to integer. Assign the address of the integer to the pointer and use the pointer to set value and print it.
Algorithm
- Declare integer variables i and *j.
- Set i = 200.
- Set j = &i.
- Write *j (i.e., display i’s value using pointer).
- Exit.
Flowchart

C++ Source Code
// program 102
#include<iostream>
using namespace std;
int main()
{
int i, *j;
i = 200;
j = &i;
cout << "\nThe value of i = " << *j;
return 0;
}
C Source Code
/*program 102*/
#include<stdio.h>
int main()
{
int i, *j;
i = 200;
j = &i;
printf("\nThe value of i = %d", *j);
return 0;
}
Output
The value of i = 200
