using unallocated memory without error?
问题 Why does that work? #include <iostream> using namespace std; int main() { float* tab[3]; int i = 0; while(i < 3) { tab[i] = new float[3-i]; i++; } cout << tab[2][7] << endl; tab[2][7] = 6.87; cout << tab[2][7] << endl; i = 0; while(i < 3) delete[] tab[i]; } while this one doesn't? #include <iostream> using namespace std; int main() { float* tab = new float[3]; cout << tab[7] << endl; tab[7] = 6.87; cout << tab[7] << endl; delete[] tab; } I tried both programs on Win XP with MS VS 2008, both