declaring the largest array using size_t
问题 i wanted to declare a very large array. i found that the max size of an array is size_t, which is defined as UINT_MAX so i wrote the code like this int arr[UINT_MAX]; when i compile this, it says overflow in array dimension but when i write like this size_t s = UINT_MAX; int arr[s]; it compiles properly. what's the difference 回答1: First error: size_t is not necessarily unsigned int , thus its maximum value can be different from the one of unsigned int ( UINT_MAX ); moreover, in C++ to get