pabloliva87

Ej2C++

Feb 13th, 2012
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.56 KB | None | 0 0
  1. #include <cstdlib>
  2. #include <iostream>
  3. #include <string.h>
  4.  
  5. #define declare_at(type,name,address)                       \
  6.         type * reference = (type *) address;                \
  7.         type & name = * (reference);                    \
  8.  
  9. using namespace std;
  10.  
  11. int main (void) {
  12.  
  13.     void * initialized;
  14.     initialized = (void*) calloc (1,sizeof(int));
  15.    
  16.     declare_at (int, pepe, initialized);
  17.  
  18.     cout << "Value: " << pepe << endl;
  19.  
  20.     ++pepe;
  21.  
  22.     cout << "Value: " << pepe << endl;
  23.     cout << "AddressAlloced: " << initialized << endl;
  24.     cout << "AddressOfPepe: " << &pepe << endl;
  25.  
  26.     return EXIT_SUCCESS;
  27. }
Add Comment
Please, Sign In to add comment