Advertisement
Dani_info

Pointeri

May 30th, 2018
106
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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
RAW Paste Data Copied
Advertisement