#include<iostream>
using namespace std;
int main()
{
int a=10;
float b=2.5;
char ch='z';
int* ptr1;
float* ptr2;
char* ptr3;
ptr1=&a;
ptr2=&b;
ptr3=&ch;
cout<<"1st way of display value of different data types:"<<endl;
cout<<"************************************************"<<endl;
cout<<"the value of integer a:"<<a<<endl;
cout<<"the value of float b:"<<b<<endl;
cout<<"the value of character ch:"<<ch<<endl;
cout<<"2nd way of display value of different data types:"<<endl;
cout<<"************************************************"<<endl;
cout<<"the value of integer a:"<<*ptr1<<endl;
cout<<"the value of float b:"<<*ptr2<<endl;
cout<<"the value of character ch:"<<*ptr3<<endl;
cout<<"1st way of display address of different data types:"<<endl;
cout<<"************************************************"<<endl;
cout<<"the address of integer a:"<<&a<<endl;
cout<<"the address of float b:"<<&b<<endl;
cout<<"the address of character ch:"<<&ch<<endl;
cout<<"2nd way of display address of different data types:"<<endl;
cout<<"************************************************"<<endl;
cout<<"the address of integer a:"<<ptr1<<endl;
cout<<"the address of float b:"<<ptr2<<endl;
cout<<"the address of character ch:"<<ptr3<<endl;
}
No comments:
Post a Comment