Welcome

Hi! This blog is for beginners of c++ and java .You can check and pick codes for your programming assignments. This will also help you to understand the concepts of these programming languages. Its all about programming.

Adding of Two Integers Using Pointers

Friday, July 1, 2011

#include<iostream.h>

int main(){
   int a = 55;
   int b = 33;
  
   int* p1;
   int* p2;
  
   p1 = &a;    // initializing p1 to address of integer a  
   p2 = &b;    // initializing p1 to address of integer b  
  
   // Adding using integers.
  
   cout << a << " + " << b << " = " << (*p1 + * p2);
        
return 0;
} // end main()