Hello,
I have some confusion with Initilization of int.
#include <iostream>
using namespace std;
int main()
{
int *p = new int[4];
for( int i = 0; i < 6568; i++ )
{
p[i] = i;
cout << i << " ->> " << p[i] << endl;
}
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int *p = new int[4];
for( int i = 0; i < 6568; i++ )
{
p[i] = i;
cout << i << " ->> " << p[i] << endl;
}
return 0;
}
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
0 ->> 0
.
.
.
.
6567 ->> 6567
0 ->> 0
.
.
.
.
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];
Bookmarks