>Then what is the point to use pointer and new operator to declare the array in the first case?
Because the second case is ill-formed and thus, illegal in C++. Array sizes in C++ must be constant integral values. If it works when you try it then that's because your compiler allows it as an extension. Only the first case is guaranteed to be correct (assuming n is already defined).
Reputation Points: 6442
Solved Threads: 1393
Bad Cop
Offline 11,807 posts
since Sep 2004