56.1k views
4 votes
Assume that ip1, ip2, and ip3 have already been declared to be of type "pointer to int". Assume further that each of these pointer variables have been initialized -- each points to some int variable. Write a statement that computes the sum of the variables that ip1 and ip2 point to, and assigns that value (the sum) to the variable that ip3 points to.

1 Answer

4 votes

Answer:

void main(){

int *ip1,*ip2,*ip3;

printf("Enter values for ip1 and ip2\\");

scanf("%d\\",ip1);

scanf("%d\\",ip2);

*ip3=*ip1+*ip2;

}

Step-by-step explanation:

*ip3=*ip1+*ip2;

this statement is used to add the values of two pointer variables and storing it in third pointer variable.

*ip1 --->ip1 gives address location of the variable and *ip1 gives the value stored at that address location

User Eranda
by
9.0k points