Answer to Question #311873 in C++ for Gaurav

Question #311873

Write a C++ program for Addition, multiplication, subtraction, division of two pointer

variable which has the address of another variable.


1
Expert's answer
2022-03-15T04:51:51-0400
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);
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment