Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 7th, 2012  |  syntax: None  |  size: 0.19 KB  |  hits: 10  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. void cp(int*& a, int* b) {
  6.   a = b;
  7. }
  8.  
  9. int main() {
  10.  
  11.   int a = 5, b=6;
  12.   int* pa = &a;
  13.  
  14.   cp(pa, &b);
  15.  
  16.   cout<<*pa<<endl;
  17.  
  18.   return 1;
  19. }