fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int a[][2] = { {0,0}, {1,1}, {2,2}};
  6. int (*p)[3]=(int(*)[3])a; // implicitly converted from array name to pointer to the first element (int(*)[2])
  7. int (*p2)[3]=(int(*)[3])a[0]; // a[3][2], access a[0], an array, implicitly converted to int*
  8. int (*p3)[3]=(int(*)[3])&a[0]; // Address of int[2] array, int(*)[2] type
  9.  
  10. cout << p << endl;
  11. cout << p2 << endl;
  12. cout << p3 << endl;
  13.  
  14. // your code goes here
  15. return 0;
  16. }
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
0xbfed3958
0xbfed3958
0xbfed3958