Write a C++ program for Addition, multiplication, subtraction, division of two pointer
variable which has the address of another variable.
using namespace std;
/*
Write a C++ program for Addition, multiplication, subtraction, division of two pointer
variable which has the address of another variable.
*/
int main()
{
int a=12,b=4;
int *ptr_a, *ptr_b;
ptr_a = &a;
ptr_b = &b;
cout<<"\n\t*ptr_a + *ptr_b = "<<*ptr_a+*ptr_b;
cout<<"\n\t*ptr_a - *ptr_b = "<<*ptr_a-*ptr_b;
cout<<"\n\t*ptr_a * *ptr_b = "<<(*ptr_a)*(*ptr_b);
cout<<"\n\t*ptr_a / *ptr_b = "<<(*ptr_a)/(*ptr_b);
return(0);
}
Comments
Leave a comment