SHARE
TWEET

Untitled

a guest Oct 15th, 2019 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5. int main() {
  6.     int **a = NULL;
  7.     int *b = NULL;
  8.  
  9.     int n = 5;
  10.     int m = 10;
  11.     int count = 0;
  12.  
  13.     a = new int * [n];
  14.     for (int i = 0; i < n; i++) {
  15.         a[i] = new int [m];
  16.         for (int j = 0; j < m; j++) {
  17.             a[i][j] = count++;
  18.         }
  19.     }
  20.  
  21.     for (int i = 0; i < n; i++) {
  22.         for (int j = 0; j < m; j++) {
  23.             cout << a[i][j] << "\t";
  24.         }
  25.         cout << endl;
  26.     }
  27.     b = (int *)a;
  28.     cout << "Hello: " << a[3][0] << endl;
  29.     cout << "Hello 1: " << b[3] << endl;
  30.     return 0;
  31. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top