Hello,

I have some confusion with Initilization of int.

Qt Code:
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. int main()
  5. {
  6. int *p = new int[4];
  7. for( int i = 0; i < 6568; i++ )
  8. {
  9. p[i] = i;
  10. cout << i << " ->> " << p[i] << endl;
  11. }
  12. return 0;
  13. }
To copy to clipboard, switch view to plain text mode 

Above, i have initilize int *p = new int[4];
when i run this program on windows it get crashed after printing

Qt Code:
  1. 0 ->> 0
  2. .
  3. .
  4. .
  5. .
  6. 6567 ->> 6567
To copy to clipboard, switch view to plain text mode 

why is it so ????


And instead of Initilizing
int *p = new int[4];