Advertisement
Dani_info

Pointeri

May 30th, 2018
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     /*int x = 2;
  8.     int *p=&x;
  9.     cout<<*&x<<endl;
  10.     cout<<p<<endl;
  11.      *p=7;
  12.     cout<<*p<<endl;
  13.     cout<<x;
  14.     /*int v[5] = {0, 3, 4, 1, 2};
  15.     cout<<v<<endl;
  16.     cout<<&v[0]<<endl;
  17.     cout<<&v[1]<<endl;
  18.     cout<<&v[2]<<endl;*/
  19.  
  20.     /*int *v = new int[7];
  21.     for (int i=0; i<7; i++)
  22.         v[i]=0;
  23.     for (int i=0; i<7; i++)
  24.         cout<<v[i]<<endl;*/
  25.  
  26.     //2d array dynamic allocation
  27.     int **v = new int *[10];
  28.     for (int i=0; i<10; i++)
  29.         v[i]=new int[2];
  30.     return 0;
  31. }
  32. Pointeri
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement